Zend_Mail weird error or unknown???

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Zend_Mail weird error or unknown???

Post by alex.barylski »

I have the following code:

Code: Select all

Zend_Mail::setDefaultTransport(new Zend_Mail_Transport_Smtp('smtp2.ourISP.com', array('name' => 'alex@domain.com', 'port' => 25)));

    $mailer = new Zend_Mail();

    $mailer->addTo($to[0], $to[1]);
    $mailer->setFrom($from[0], $from[1]);

    $mailer->setSubject($subject);
    $mailer->setBodyHtml($message);

    $mailer->send();
If I provide the full email as my user name 'alex@domain.com' I get the following exception:
'alex@domain.com' appears to be a DNS hostname but cannot match against hostname schema for TLD 'com', 'alex@domain.com' does not appear to be a valid local network name
Our ISP has a different domain than does the domain on which I am trying to send. These details appear to work for Ouytlook when sending my my computer and the PHP code is also running locally so those credcentials should work.

When I use just 'alex' without TLD and domain I get an exception 'unknown'

Any ideas on what I am doing wrong???

I have used Swift many times in the past and usually provide a host, username (full email) and password, in this case passwords do not seem to exist in the SMTP transport API???

Cheers,
Alex
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: Zend_Mail weird error or unknown???

Post by alex.barylski »

I switched up the code a bit:

Code: Select all

$options = array
    (
      'ssl' => 'tls',
      //'port' => 25,
      'auth' => 'login',
      'name' => 'alex',
      //'username' => 'alex@domain.com',
      //'password' => ''
    );

    $server = new Zend_Mail_Transport_Smtp('smtp2.myISP.com', $options);

    $mailer = new Zend_Mail();

    $mailer->addTo($to[0], $to[1]);
    $mailer->setFrom($from[0], $from[1]);

    $mailer->setSubject($subject);
    $mailer->setBodyHtml($message);

    $mailer->send($server);
Now I get an exception 'Command' thats it's???

Cheers,
Alex
Post Reply