0

stackoverflow.comで多くの回答が見つかりましたが、役に立たなかったので、質問せざるを得ません

問題:Phpmailer はメールを送信しますが、空のメールです! ノーボディノーアタッチメント!

//Create a new PHPMailer instance
$mail = new PHPMailer();

$mail->CharSet = 'UTF-8';

$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host       = "ssl://smtp.gmail.com"; // SMTP server
$mail->SMTPAuth   = true;                  // enable SMTP authentication
$mail->Port       = 465;  // set the SMTP port for the GMAIL server; 465 for ssl and 587 for tls
$mail->Username   = "services@domain.xxx"; // Gmail account username
$mail->Password   = "pwd";        // Gmail account password


//$mail->Mailer = 'smtp';
//Set who the message is to be sent from
$mail->SetFrom(service_mail_d, 'XXXX Services');
//Set an alternative reply-to address
$mail->AddReplyTo(service_mail_d, 'XXXX Services');
//Set who the message is to be sent to
$mail->AddAddress("testcenter@xxxx.xxxxx", "Client1");
//Set the subject line
$mail->Subject = "service_order_subject" ;
//Read an HTML message body from an external file, convert referenced images to embedded,convert HTML into a basic plain-text alternative body
$mail->MsgHTML("<h1>Simple TEST</h1>");
$mail->AddStringAttachment($generator_file_content,$generatorId ."html",'UTF-8','text/html');
 //Send the message, check for errors
$mailSend=$mail->Send();

アップデート:

StringAttachment が追加されていない場合、送信メールと MsgBody が表示されます。

4

2 に答える 2

0

問題は、「encoding」パラメーターの誤解です。このパラメーターは、ファイルのエンコーディングを示すのではなく、ファイルのターゲット MIME エンコーディングを示します。ドキュメントから、次の値のいずれかを使用できます。

  • base64
  • 7ビット
  • 8ビット
  • バイナリ
  • 引用された印刷可能
于 2015-01-06T19:50:38.310 に答える