首页 > 解决方案 > 无法在 PHPMailer 中使用(图像)发送电子邮件

问题描述

我想用 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>';
}
}

标签: phpphpmailerhtml-email

解决方案


推荐阅读