Attachment empty/blank when sending mail using phpmailer
Posted
by chupinette
on Stack Overflow
See other posts from Stack Overflow
or by chupinette
Published on 2010-05-04T16:21:44Z
Indexed on
2010/05/04
16:28 UTC
Read the original article
Hit count: 290
Hello! I am using phpmailer class to send email and i am attaching a file to the mail. The email is sent successfully but the attachment which is an sql file is empty which should not be the case. I have tried with an image file, but it seems that every file that i attach is empty. Can anyone help me solve this problem please?
$mail = new PHPMailer();
$body = "Reminder";
$mail->IsSMTP();
$mail->Host = "mail.yourdomain.com";
$mail->SMTPDebug = 1;
$mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl";
$mail->Host = "smtp.gmail.com";
$mail->Port = 465;
$mail->Username = "[email protected]";
$mail->Password = "abc";
$mail->SetFrom('[email protected]',
'blbla');
$mail->AddReplyTo("[email protected]","First Last");
$mail->Subject = "Your order has been successfully placed"
$mail->MsgHTML($body);
$mail->AddAddress("[email protected]","xyz");
$mail->AddAttachment("D:\b2\shop3.sql","shop3.sql");
I have tried to display the size of the file before attaching it, and it actually displays the file size. Can anyone help me please?
© Stack Overflow or respective owner