在PHPMailer中无法使用(图片)发送电子邮件

时间:2018-07-26 09:03:18

标签: php phpmailer html-email

我想用PHP电子邮件发送附件,但是它不起作用。你能帮忙吗?

require 'class/class.phpmailer.php';
$mail = new PHPMailer;
$mail->IsSMTP();
$mail->SetLanguage("tr", "class/phpmailer.lang-tr.php");
$mail->CharSet  ="utf-8";
$mail->Encoding="base64";                               
$mail->Host = '*****************';      
$mail->Port = '587';                                
$mail->SMTPAuth = true;                         
$mail->Username = '*********************';                  
$mail->Password = '*';          *******************     
$mail->SMTPSecure = 'tls';                          
$mail->From = $_POST["email"];                  
$mail->FromName = $_POST["name"];               
$mail->AddAddress('**********************', '***************************');     
$mail->WordWrap = 50;                           
$mail->IsHTML(true);                            
$mail->AddAttachment($path);                    
$mail->Subject = '*************************';               
$mail->Body = $message;                         
if($mail->Send())                               
{
    $message = '<div class="alert alert-success">Destek Talebiniz Tarafımıza Ulaşmıştır</div>';
    unlink($path);
}
else
{
    $message = '<div class="alert alert-danger">There is an Error</div>';
}
}

0 个答案:

没有答案