Page 1 of 1

The sender's email address is not displayed correctly by the recipient.

Posted: 2020-04-18 11:11
by fgazza
Hello to all.

I set in the hook file of the "partecipazione_riunione_evento_partner" table the automatic sending of an email to the users when they fill in the table.

I don't know why but the email that arrives to users does not appear with the address I set ([email protected]) but with a "strange" address that has to do with my email provider. The strange address that appear is:
[email protected]

This makes it difficult for users to notice the notification by e-mail of the correct compilation of the form and I believe it also facilitates the automatic archiving as spam in their e-mail boxes (especially for those who use gmail).

I hope someone can give me some suggestions.

Here is the code that I put in the hook file.

Thank you all!

Fabiano Gazza

__________ code__________

function partecipazione_riunione_evento_partner_after_insert($data, $memberInfo, &$args){

// to compose a message containing the submitted data,
// we need to iterate through the $data array
//foreach($data as $field => $value){
//$messageData .= "$field: $value \n";
//}

$titolo_evento = sqlValue(
"SELECT titolo FROM appuntamenti where pri_key = '{$data['riunione_evento']}'"
);

$data_evento = sqlValue(
"SELECT data_appuntamento FROM appuntamenti where pri_key = '{$data['riunione_evento']}'"
);

$data_evento = date("d-m-Y", strtotime ($data_evento));

$dove_evento = sqlValue(
"SELECT luogo FROM appuntamenti where pri_key = '{$data['luogo_evento']}'"
);

$orario_inizio_evento = sqlValue(
"SELECT ora_inizio FROM appuntamenti where pri_key = '{$data['orario']}'"
);

$orario_fine_evento = sqlValue(
"SELECT ora_fine FROM appuntamenti where pri_key = '{$data['orario']}'"
);

$eventuali_altre_date_luoghi_orari = sqlValue(
"SELECT piu_date_luoghi_orari FROM appuntamenti where pri_key = '{$data['altre_date_luoghi_orari']}'"
);

$e_mail_informazioni = sqlValue(
"SELECT recapito_mail_info FROM appuntamenti where pri_key = '{$data['e_mail_per_info']}'"
);

$ente_appartenenza_partecipante = sqlValue(
"SELECT nome_ente FROM enti_partner where pri_key = '{$data['ente_di_appartenenza']}'"
);

@mail(
// mail recipient
// da aggiungere per recuperare in automatico l'indirizzo e-mail inserito nel campo e_mail_per_info,
"$e_mail_informazioni",

// subject
"Sulla Buona Strada - Notifica iscrizione evento",

// message
"Si trasmette notifica di nuova iscrizione all'evento $titolo_evento.\n\nDi seguito trovi i dati relativi al nuovo iscritto.\n\n".

"Evento: $titolo_evento\n".
"Data: $data_evento\n".
"Luogo: $dove_evento\n".
"Orario: dalle $orario_inizio_evento alle $orario_fine_evento\n".
"$eventuali_altre_date_luoghi_orari\n\n".
"PARTECIPANTE\n".
"Nome: {$data['nome']}\n".
"Cognome: {$data['cognome']}\n\n".
"Ente: $ente_appartenenza_partecipante {$data['ente_non_elencato_sopra']}\n\n".
"E-mail: {$data['recapito_email']}\n".
"Telefono: {$data['recapiti_telefonici']}\n\n\n".
"L'elenco degli iscritti agli appuntamenti da te gestiti è sempre visibile nell'area AGENDA-->APPUNTAMENTI del portale sullabuonastrada.org/governance\n\n".

// sender address
"From: [email protected]"

);
}

return TRUE;
}

Re: The sender's email address is not displayed correctly by the recipient.

Posted: 2020-04-19 18:45
by jsetzer
Did you setup SMTP correctly in Admin settings? Using SMTP you can control the sender. Otherwise SENDMAIL will be used, probably configured by your provider