0
I have set up Phpmailer and it is sending the emails correctly, but in the mailbox of my account these sent emails are not registered. I have to make some configuration for that?
0
I have set up Phpmailer and it is sending the emails correctly, but in the mailbox of my account these sent emails are not registered. I have to make some configuration for that?
1
There’s no way they can be saved, because this is function of mail manager whatever you’re using.
With the Phpmailer, is not using any, only authenticating to send the email, so there is the copy.
Some options:
Sending as copy:
$mail->addCC('[email protected]');
Sending as hidden copy:
$mail->addBCC('[email protected]');
# verificação se o e-mail foi enviado ou teve erros
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
$save_result = save_mail($mail); # chama a função para envio da cópia via IMAP
if ($save_result) {
echo "Message saved!";
}
}
# função para chamar IMAP: https://php.net/manual/en/book.imap.php
function save_mail($mail) {
# Você pode enviar para a pasta de enviados ou alguma tag
$path = "{imap.gmail.com:993/imap/ssl}[Gmail]/Sent Mail";
# autenticando
$imapStream = imap_open($path, $mail->Username, $mail->Password);
# você pode usar imap_getmailboxes($imapStream, '/imap/ssl') para obter a lista de pastas e tags
//Can be useful if you are trying to get this working on a non-Gmail IMAP server.
$result = imap_append($imapStream, $path, $mail->getSentMIMEMessage());
imap_close($imapStream);
# retorna o resultado
return $result;
}
Some links about Phpmailer:
Sending email with multiple senders and recipients
Browser other questions tagged php phpmailer
You are not signed in. Login or sign up in order to post.
Wow, thank you so much!! It will help so much.
– Trimander
@Trimander any doubt we’re there!
– rbz