Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to send email using Google OAuth (via SMTP)?
    primarykey
    data
    text
    <p>Have read <a href="https://stackoverflow.com/questions/2977961/gmail-3-legged-oauth-access-zend-mail-protocol-exception">this</a> and <a href="https://stackoverflow.com/questions/2602680/how-to-implement-gmail-oauth-api-to-send-email-especially-via-smtp">this</a> and using example from <a href="http://code.google.com/p/google-mail-xoauth-tools/wiki/PhpSampleCode" rel="nofollow noreferrer">here</a>.</p> <p>However, I am still having difficulty in sending emails as a verified Google user using OAuth. I have the valid OAuth tokens, secrets, and xoauth token as well.</p> <p>My code to send the email:</p> <pre><code>$authenticateParams = array('XOAUTH', $initClientRequestEncoded); $smtp = new Zend_Mail_Protocol_Smtp('smtp.gmail.com', 587, array( "AUTH" =&gt; $authenticateParams, 'ssl' =&gt; 'tls')); try { // Create a new mail object $mail = new Zend_Mail(); $mail-&gt;setFrom("aaaaa@gmail.com"); $mail-&gt;addTo("bbbbb@gmail.com"); $mail-&gt;setSubject("Your account has been created"); $email = "Thank you for registering!"; $mail-&gt;setBodyText($email); $mail-&gt;send(); } catch (Exception $e) { echo "error sending email . &lt;BR&gt;" . $e; } </code></pre> <p>But this seems to send an anonymous email and not as the user authenticated. If I do:</p> <pre><code>$smtp = new Zend_Mail_Transport_Smtp('smtp.gmail.com', array('AUTHENTICATE' =&gt; $authenticateParams, 'ssl' =&gt; 'tls')); Zend_Mail::setDefaultTransport($smtp); </code></pre> <p>I get: exception 'Zend_Mail_Protocol_Exception' with message '5.5.1 Authentication Required.</p> <p>I'm sure it's just a case of getting the mail transport smtp params right, but the documentation for sending SMTP emails is non-existent and I can't find any code examples for this.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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