I use PHPMailer to send email via SMTP. It works, but it doesn't save the sent emails in
sent items
. I want to make to sent emails in the sent items
, any idea?
I know can use imap_append
function to achieve it. But, how to do that?
The PHPMailer seems doesn't has the function to return the $message.
if ($return = $mail->Send()) {
$stream = imap_open("{{$host}:993/imap/ssl}Sent Items", $user_name, $user_pwd);
imap_append($stream, "{{$host}:993/imap/ssl}Sent Items" , $message , "\\Seen");
imap_close($stream);
};
How to get the message body from PHPMailer?
PHPMailer doesn't create/use any SQL itself, nor does it have anything to do with javascript, so it's secure on those fronts.
PHPMailer can use a non-local mail server (SMTP) if you have authentication. Further advantages include: It can print various kinds of error messages in more than 40 languages when it fails to send an email. It has integrated SMTP protocol support and authentication over SSL and TLS.
The instance variables from PHPMailer are all public. Looking at the source you can just use:
$mail->Body
If you want the plain body including the all boundaries you could also use:
$mail->CreateBody();
See: http://phpmailer.svn.sourceforge.net/viewvc/phpmailer/trunk/phpmailer/class.phpmailer.php?revision=452&view=markup
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With