私は現在、オンライン レジストリ システムを構築しており、そのモジュールの 1 つは登録システムです。
ユーザーが正常に登録されると、確認メールがユーザーのメール アドレスに送信されます。オンラインで読んだすべてのチュートリアルに従いましたが、まだ同じ問題が発生しています。
これが私がこれまでに得たものです:
//this is what it looks like in my controller after validation of fields from registration
$this->load->library('email');
$this->email->set_newline("\r\n");
$this->email->from('my_personal_email@gmail.com', 'Mike Lee');
$this->email->to($email);
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');
if($this->email->send()){
//this is to check if email is sent
redirect('site/registered');
}else{
//else error
show_error($this->email->print_debugger());
}
私のemail.phpの構成について:
class CI_Email {
var $useragent = "CodeIgniter";
var $mailpath = "/usr/sbin/sendmail"; // Sendmail path
var $protocol = "smtp"; // mail/sendmail/smtp
var $smtp_host = "https://smtp.googlemail.com"; // SMTP Server. Example: mail.earthlink.net
var $smtp_user = "my_personal_email@gmail.com"; // SMTP Username
var $smtp_pass = "my_personal_emailpassword"; // SMTP Password
var $smtp_port = "25"; // SMTP Port
var $smtp_timeout = 10; // SMTP Timeout in seconds
var $smtp_crypto = ""; // SMTP Encryption. Can be null, tls or ssl.
var $wordwrap = TRUE; // TRUE/FALSE Turns word-wrap on/off
var $wrapchars = "76"; // Number of characters to wrap at.
var $mailtype = "text"; // text/html Defines email formatting
var $charset = "utf-8"; // Default char set: iso-8859-1 or us-ascii
var $multipart = "mixed"; // "mixed" (in the body) or "related" (separate)
var $alt_message = ''; // Alternative message for HTML emails
var $validate = FALSE; // TRUE/FALSE. Enables email validation
var $priority = "3"; // Default priority (1 - 5)
var $newline = "\n"; // Default newline. "\r\n" or "\n" (Use "\r\n" to comply with RFC 822)
var $crlf = "\n"; // The RFC 2045 compliant CRLF for quoted-printable is "\r\n". Apparently some servers,
// even on the receiving end think they need to muck with CRLFs, so using "\n", while
// distasteful, is the only thing that seems to work for all environments.
var $send_multipart = TRUE; // TRUE/FALSE - Yahoo does not like multipart alternative, so this is an override. Set to FALSE for Yahoo.
var $bcc_batch_mode = FALSE; // TRUE/FALSE Turns on/off Bcc batch feature
var $bcc_batch_size = 200; // If bcc_batch_mode = TRUE, sets max number of Bccs in each batch
var $_safe_mode = FALSE;
var $_subject = "";
var $_body = "";
var $_finalbody = "";
var $_alt_boundary = "";
var $_atc_boundary = "";
var $_header_str = "";
var $_smtp_connect = "";
var $_encoding = "8bit";
var $_IP = FALSE;
var $_smtp_auth = FALSE;
var $_replyto_flag = FALSE;
var $_debug_msg = array();
var $_recipients = array();
var $_cc_array = array();
var $_bcc_array = array();
var $_headers = array();
var $_attach_name = array();
var $_attach_type = array();
var $_attach_disp = array();
var $_protocols = array('mail', 'sendmail', 'smtp');
var $_base_charsets = array('us-ascii', 'iso-2022-'); // 7-bit charsets (excluding language suffix)
var $_bit_depths = array('7bit', '8bit');
var $_priorities = array('1 (Highest)', '2 (High)', '3 (Normal)', '4 (Low)', '5 (Lowest)');
エラーは次のとおりです。
/* PHP エラーが発生しました
重大度: 警告
メッセージ: fsockopen() [function.fsockopen]: ssl://smtp.googlemail.com:25 に接続できません (接続先が一定時間後に適切に応答しなかったため、接続試行が失敗したか、接続の確立に失敗しました。接続されたホストが応答しませんでした。)
ファイル名: libraries/Email.php
行番号: 1689 */
個人のメール アカウントを使用してテスト メールを送信します。しかし、それがgmailで機能するかどうかはわかりません。私のコードが機能しているかどうかをテストする方法を教えてもらえますか? または、メールを送信するためのテスト サーバーとして使用できるソフトウェアはありますか?
ありがとう。:(