I'm actually using the default Sendmail.php transport. The exception
message does not contain any useful info since the php mail() function
only returns FALSE on failure.
Here is my test program. I replaced the real email addresses with xxx.com
and xxx894.org
$ cat email_test.php
?php
error_reporting(E_ALL);
require_once './config.php';
require_once 'Zend/Mail.php';
$mail = new Zend_Mail();
$mail-setBodyText('This is the text of the mail.');
$mail-setFrom('[EMAIL PROTECTED]', 'Art Hundiak');
$mail-addTo('[EMAIL PROTECTED]', 'Art Hundiak');
$mail-setSubject('TestSubject');
$mail-send();
/* -
* The actual php mail() seems to work
* using an example from the manual
*/
$to = '[EMAIL PROTECTED]';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: [EMAIL PROTECTED]' . \r\n .
'Reply-To: [EMAIL PROTECTED]' . \r\n .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?
And here is a Zend::dump($this) from inside of the transport object when
mail() fails.
(hathor.telana.com:ahundiak) /home/ahundiak/ws2007/osso2007/apps/mail
$ php email_test.php
/usr/sbin/sendmail: unexpected response 501 to RCPT TO command
object(Zend_Mail_Transport_Sendmail)#3 (10) {
[subject] = NULL
[EOL] = string(1)
[body] = string(29) This is the text of the mail.
[boundary] = string(0)
[header] = string(162) From: Art Hundiak [EMAIL PROTECTED]
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
[_headers:protected] = array(6) {
[From] = array(2) {
[0] = string(36) Art Hundiak [EMAIL PROTECTED]
[append] = bool(true)
}
[To] = array(2) {
[0] = string(33) Art Hundiak [EMAIL PROTECTED]
[append] = bool(true)
}
[Subject] = array(1) {
[0] = string(11) TestSubject
}
[Content-Type] = array(1) {
[0] = string(32) text/plain; charset=iso-8859-1
}
[Content-Transfer-Encoding] = array(1) {
[0] = string(16) quoted-printable
}
[Content-Disposition] = array(1) {
[0] = string(6) inline
}
}
[_isMultipart:protected] = bool(false)
[_mail:protected] = object(Zend_Mail)#1 (13) {
[_charset:protected] = string(10) iso-8859-1
[_headers:protected] = array(3) {
[From] = array(2) {
[0] = string(36) Art Hundiak [EMAIL PROTECTED]
[append] = bool(true)
}
[To] = array(2) {
[0] = string(33) Art Hundiak [EMAIL PROTECTED]
[append] = bool(true)
}
[Subject] = array(1) {
[0] = string(11) TestSubject
}
}
[_from:protected] = string(20) [EMAIL PROTECTED]
[_to:protected] = array(1) {
[0] = string(17) [EMAIL PROTECTED]
}
[_recipients:protected] = array(1) {
[[EMAIL PROTECTED]] = int(1)
}
[_returnPath:protected] = NULL
[_subject:protected] = string(11) TestSubject
[_bodyText:protected] = object(Zend_Mime_Part)#2 (10) {
[type] = string(10) text/plain
[encoding] = string(16) quoted-printable
[id] = NULL
[disposition] = string(6) inline
[filename] = NULL
[description] = NULL
[charset] = string(10) iso-8859-1
[boundary] = NULL
[_content:protected] = string(29) This is the text of the mail.
[_isStream:protected] = bool(false)
}
[_bodyHtml:protected] = bool(false)
[_mimeBoundary:protected] = NULL
[hasAttachments] = bool(false)
[_parts:protected] = array(0) {
}
[_mime:protected] = object(Zend_Mime)#4 (1) {
[_boundary:protected] = string(34)
=_514e84fd17a78051290527df8f4259f7
}
}
[_parts:protected] = array(1) {
[0] = object(Zend_Mime_Part)#2 (10) {
[type] = string(10) text/plain
[encoding] = string(16) quoted-printable
[id] = NULL
[disposition] = string(6) inline
[filename] = NULL
[description] = NULL
[charset] = string(10) iso-8859-1
[boundary] = NULL
[_content:protected] = string(29) This is the text of the mail.
[_isStream:protected] = bool(false)
}
}
[recipients] = string(33) Art Hundiak [EMAIL PROTECTED]
}
Does the exception contain an example of the SMTP command? A 501
means that the request is a bit screwy.
Perhaps if you could look at enabling the debug constant (line 44 of
Zend/Mail/Transport/Smtp.php) and it will display the transaction so
you can see what is going on and email the list with the results?
Would be happy to fix for you ASAP.
Cheers
Has anyone tried Zend_Mail on a PHP 5.2.0 machine? A simple
working app
of mine stopped working after the host upgraded from 5.1.x
The example from the manual generates:
/usr/sbin/sendmail: unexpected response 501 to RCPT TO command
Followed by an exception.
Same code is working fine on a 5.1.6 machine.
Thanks in advance
--
Simon Mundy | Director | PEPTOLAB
202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000
Voice