我有一个使用CodeIgniter构建的Web应用程序3. Tank auth用作身份验证层。电子邮件将根据创建的帐户和其他触发器发送给用户。我不希望用户看到我的实际电子邮件地址,只有noreply@example.com
。
我使用Gmail SMTP配置:
$config['mailtype'] = 'html';
$config['charset'] = 'utf-8';
$config['newline'] = "\r\n";
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.gmail.com';
$config['smtp_port'] = 465;
$config['smtp_user'] = 'xxxx@gmail.com';
$config['smtp_pass'] = 'xxxx';
这是我的测试邮件功能:
$from = $reply_to = 'noreply@example.com';
$subject = lang('test_send_email_subject');
$this->config->load('email', TRUE);
$email_config = $this->config->item('email');
$this->load->library('email', $email_config);
$this->email->from($from, 'example');
$this->email->reply_to($reply_to, 'example');
$this->email->to($to);
$this->email->subject($subject);
$this->email->message(lang('test_send_email_message'));
$result = $this->email->send(FALSE);
$this->session->set_flashdata('debugger_result', $this->email->print_debugger());
我得到的调试器结果实际上是从电子邮件地址正确显示为noreply@example.com,这是我在代码中设置的内容:
220 smtp.gmail.com ESMTP i192sm2099289lfb.14 - gsmtp
hello: 250-smtp.gmail.com at your service, [89.166.7.101]
250-SIZE 35882577
250-8BITMIME
250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-CHUNKING
250 SMTPUTF8
from: 250 2.1.0 OK i192sm2099289lfb.14 - gsmtp
to: 250 2.1.5 OK i192sm2099289lfb.14 - gsmtp
data: 354 Go ahead i192sm2099289lfb.14 - gsmtp
250 2.0.0 OK 1454662672 i192sm2099289lfb.14 - gsmtp
quit: 221 2.0.0 closing connection i192sm2099289lfb.14 - gsmtp
Your message has been successfully sent using the following protocol: smtp
User-Agent: CodeIgniter
Date: Fri, 5 Feb 2016 16:57:50 +0800
From: "example" <noreply@example.com>
Return-Path: <noreply@example.com>
Reply-To: "example" <noreply@example.com>
To: xxx@example.com
Subject: Test Email
X-Sender: noreply@example.com
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <56b4640e47745@example.com>
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="B_ALT_56b4640e4776b"
This is a multi-part message in MIME format.
Your email application may not support this format.
--B_ALT_56b4640e4776b
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This is a test email, nice to know it works.
--B_ALT_56b4640e4776b
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
This is a test email, nice to know it works.
--B_ALT_56b4640e4776b--
但是,我收到的电子邮件不是:
请帮助,谢谢。