私はHTML形式の電子メールを作成しました。私はPHP(mail();関数を使用して)を送信する予定でした。しかし、私がこれをしたとき、メールはhotmailとgmailアカウントに届かなかった。私はちょっと調べてみて、人々はPHPmailerの使用を提案しました。誰かがphpmailerで私を助けてくれますか?
PHPmailerをダウンロードし、私のサーバーにインストールしました。ここまでは順調ですね。私はいくつかの問題を持って
<?php
set_include_path('.:c:\domains\mydomain\wwwroot\phpmailer\phpmailer.inc.php');
set_include_path('.:c:\domains\mydomain\wwwroot\phpmailer\smtp.inc.php');
require("phpmailer.inc.php");
$mail = new PHPMailer();
$mail->IsHTML(true);
$mail->From = "[email protected]";
$mail->AddAddress("[email protected]");
$mail->Subject = "An HTML Message";
$mail->Body = "Hello, <b>my friend</b>! \n\n This message uses HTML entities!";
if($mail->Send()) {
echo 'Message is sent';
} else {
echo 'Message was not sent..';
echo 'Mailer error: ' . $mail->ErrorInfo;
}
?>
:しかし、今、私は次のコードを持っているの出力は、電子メールが送信されていない私に指示
- を、それがあります。
- 私は2つのサブジェクトを取得します
- html(テーブルのような)を追加すると、それでもホットメール(おそらくgmail)によって拒否されます。
また、SMTP機能があります。この機能の使い方は?自分のSMTPを書き留める必要がありますか?
誰かが私を助けてくれたら大変うれしいですね。
編集:私は別のプロジェクトでphpmailerのを使用
class SMTP {
var $SMTP_PORT = 25; # the default SMTP PORT
var $CRLF = "\r\n"; # CRLF pair
var $smtp_conn; # the socket to the server
var $error; # error if any on the last call
var $helo_rply; # the reply the server sent to us for HELO
var $do_debug; # the level of debug to perform
/*
* SMTP()
*
* Initialize the class so that the data is in a known state.
*/
function SMTP() {
$this->smtp_conn = 0;
$this->error = null;
$this->helo_rply = null;
$this->do_debug = 0;
}
サーバによってあなたは 'リモートserver'を意味していますか? set_inclide_pathにローカルサーバーパスが含まれていますか? PHPMailerはあなたのローカルサーバでは動作しません –
Nah、サーバーで私は自分のウェブサイトを意味しました。申し訳ありません – Frank