Note that there are some explanatory texts on larger screens.

plurals
  1. POSending mail via Gmail SMTP with PHP Zend error - UGFzc3dvcmQ6
    text
    copied!<p>I am trying to use the Zend Framework to send mail with Gmail, but have been unable to do so because it seems to reject the username and password (which I can use to login to gmail.com and with Outlook etc).</p> <p>My PHP code is:</p> <pre><code>&lt;?php $tr = new Zend_Mail_Transport_Smtp("smtp.gmail.com",array('user' =&gt; '****@gmail.com', 'password' =&gt; '****', 'auth' =&gt; 'login', 'ssl' =&gt; 'TLS')); Zend_Mail::setDefaultTransport($tr); $mail = new Zend_Mail(); $mail-&gt;setFrom('sender@example.com', 'Some Sender'); $mail-&gt;addTo('****@hotmail.com', 'Some Recipient'); // my Hotmail account $mail-&gt;setSubject('Test Subject'); $mail-&gt;setBodyText('This is the text of the mail.'); try { $sent = $mail-&gt;send($tr); } catch (Zend_Mail_Exception $e) { die($e); } ?&gt; </code></pre> <p>The exception thrown by Zend is:</p> <pre><code>exception 'Zend_Mail_Protocol_Exception' with message 'UGFzc3dvcmQ6 ' in C:\Users\Admin\Documents\Wamp\bin\php\php5.3.0\lib\Zend\Mail\Protocol\Abstract.php:431 Stack trace: #0 C:\Users\Admin\Documents\Wamp\bin\php\php5.3.0\lib\Zend\Mail\Protocol\Smtp\Auth\Login.php(95): Zend_Mail_Protocol_Abstract-&gt;_expect(235) #1 C:\Users\Admin\Documents\Wamp\bin\php\php5.3.0\lib\Zend\Mail\Protocol\Smtp.php(217): Zend_Mail_Protocol_Smtp_Auth_Login-&gt;auth() #2 C:\Users\Admin\Documents\Wamp\bin\php\php5.3.0\lib\Zend\Mail\Transport\Smtp.php(200): Zend_Mail_Protocol_Smtp-&gt;helo('localhost') #3 C:\Users\Admin\Documents\Wamp\bin\php\php5.3.0\lib\Zend\Mail\Transport\Abstract.php(348): Zend_Mail_Transport_Smtp-&gt;_sendMail() #4 C:\Users\Admin\Documents\Wamp\bin\php\php5.3.0\lib\Zend\Mail.php(1194): Zend_Mail_Transport_Abstract-&gt;send(Object(Zend_Mail)) #5 C:\Users\Admin\Documents\Wamp\www\Reader\scripts\modules\mail\send.php(63): Zend_Mail-&gt;send(Object(Zend_Mail_Transport_Smtp)) #6 {main} </code></pre> <p>By going into Zend\Mail\Protocol\Abstract.php I found that the full $errMsg was:</p> <pre><code>UGFzc3dvcmQ6 5.7.1 Username and Password not accepted. Learn more at 5.7.1 http://mail.google.com/support/bin/answer.py?answer=14257 fx12sm2756834wbb.59 </code></pre> <p>I know that UGFzc3dvcmQ6 is "Password:" encoded in base64, but what does "fx12sm2756834wbb.59" mean, and how can I fix the error - should I be changing the port or ssl or auth or server or something? Or should I try it with another account?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload