Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-18-2008, 06:23 PM
Junior Member
 
Join Date: Feb 2008
Posts: 1
Default Changing From header with Gmail smtp

I'm testing Gmail as a smtp platform. It works great, but I seem unable to modify the From address using the setFrom() method.

$config = array('auth' => 'login',
'username' => 'myaccount [at] gmail.com',
'password' => 'mypassword',
'ssl' => 'tls',
'port' => 587);

$userNotification = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $config);

$mail = new Zend_Mail();
$mail->setFrom('another [at] email.com','Another Email');
$mail->addHeader('another [at] email.com');
$mail->setReturnPath('another [at] email.com');
$mail->addTo($userEmail);
$mail->setSubject($usernotificationsubject);
$mail->setBodyText($usernotificationmessage);
$mail->send($userNotification);

I get a email with this "From:" header --> "Another Email <myaccount [at] gmail.com>"
instead of "Another Email <another [at] email.com>"

I tried :
$mail->addHeader('From','another [at] email.com');
but the execution fails with this line.

Is there any alternatives?

Thanks!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 01:58 PM.