我剛剛將我的網站從一個託管公司移至另一個託管公司。但在這個過程中,如果我使用附件發送,我的電子郵件功能將不起作用。發送附件時電子郵件失敗
這是從調試器:
Unable to send email using PHP mail(). Your server might not be configured to send mail using this method.
User-Agent: CodeIgniter
Date: Sat, 1 Jun 2013 03:01:46 +0700
From: "My name"
Return-Path:
Reply-To: "[email protected]"
X-Sender: [email protected]
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <[email protected]>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="B_ATC_51a901aa74aa0"
=?iso-8859-1?Q?Email_Test?=
This is a multi-part message in MIME format.
Your email application may not support this format.
--B_ATC_51a901aa74aa0
Content-Type: multipart/alternative; boundary="B_ALT_51a901aa74a67"
--B_ALT_51a901aa74a67
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Testing the email class.
--B_ALT_51a901aa74a67
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
Testing the email class.
--B_ALT_51a901aa74a67--
--B_ATC_51a901aa74aa0
Content-type: image/png; name="screenshot.png"
Content-Disposition: attachment;
Content-Transfer-Encoding: base64
這是我的代碼
$config['set_newline'] = "\r\n";
$config['mailtype'] = 'html';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = TRUE;
$this->email->initialize($config);
$this->email->from('[email protected]', 'Me');
$this->email->to('[email protected]');
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');
$this->email->attach('screenshot.png'); //I put it on root directory of CI
$this->email->send();
echo $this->email->print_debugger();
但是,如果我發送電子郵件使用CI外庫的附件,它的工作。實際上,我現在的解決方案是幫助不使用CI庫發送郵件。但是如果有什麼辦法可以繼續使用CI庫,那將會很棒。
它的工作原理,如果你註釋掉'$這個 - >的電子郵件 - >附加(」 screenshot.png');'?或者換句話說:是真的是導致問題的附件,還是CodeIgniter的電子郵件功能配置? –
邑...如果我不附加任何文件,它將工作 – l1th1um