I have records in MySql
, basically with columns:
usuario, emailusuario, descricao, responsavel, emailresponsavel
.
I need to make a new registration, send an email to the user ( emailusuario
) and the responsible ( emailresponsavel
).
I use PHPMailer, with a Gmail
account for the submissions, but the problem is, that the email arrives with sending email to the Gmail account and not with the sender's email would be what makes the new record), even setting $mail->SetFrom('[email protected]','usuario');
.
$mail->AddReplyTo()
works normally.
I wonder if this occurs because it is authenticated by Gmail
, because it is TLS
, or some other reason, and if there is another way of doing it, the problem is PHPMailer
. I need to do this, regardless of whether I have to change the SMTP
or biblioteca
.
Upload script:
require_once '/PHPMailer/PHPMailerAutoload.php';
$srvNome = 'smtp.gmail.com';
$srvPort = '587';
$srvEmail = '[email protected]';
$srvSenha = '****';
$emailAssunto = 'NOVO REGISTRO';
$emailDestinatario = $emailDest1;
$titulo = 'NOVO REGISTRO';
$conteudo = "teste";
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 2;
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'tls';
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
$mail->CharSet = 'UTF-8';
$mail->Host = $srvNome;
$mail->Port = $srvPort;
$mail->Username = $srvEmail;
$mail->Password = $srvSenha;
$mail->AddReplyTo($emailRemetente,$remetenteNome);
$mail->SetFrom($emailRemetente,$remetenteNome);
$mail->IsHTML(true);
$mail->Subject = $emailAssunto;
$mail->Body = $conteudo;
$mail->AddAddress($emailDestinatario);
if(!$mail->Send()) echo 'erro';