title: Sendgrid Unauthenticated senders not allowed error php, zf2
body: <p>I have integrate Sendgrid for my Zend Framework 2 Application using STMP API and i have used Zend Transport for but I get a error </p>
  
  <p>"Caught exception: Cannot receive from specified address : Unauthenticated senders not allowed"</p>
  
  <pre><code> $request = $this-&gt;getRequest();
      //$form = new Add();
      // $product = new Product();
      $username = 'XXX';
      $password ='XXXX';
      if ($request-&gt;isXmlHttpRequest()){ // If it's ajax call
          $email = $request-&gt;getPost('email_add');
          $message = $request-&gt;getPost('message');
          try{
              $message = new Message();
              $message-&gt;addTo('jainudeenf007@gmail.com')
                  -&gt;addFrom('fawazj@digitalglare.com.au')
                  -&gt;setSubject('Greetings and Salutations!')
                  -&gt;setBody("Sorry, I'm going to be late today!");
              $transport = new SmtpTransport();
              $options   = new SmtpOptions(array(
                  'name'              =&gt; 'sendgrid.com',
                  'host'              =&gt; 'smtp.sendgrid.net',
                  'port'              =&gt; 587, // Notice port change for TLS is 587
                  'connection_class'  =&gt; 'smtp',
                  'connection_config' =&gt; array(
                      'auth' =&gt; 'login',
                      'username' =&gt; 'XXXXXX',
                      'password' =&gt; 'XXXXXX',
                      'ssl'      =&gt; 'tls'
                  ),
              ));
              $transport-&gt;setOptions($options);
              $transport-&gt;send($message);
              exit;
          }catch (\Exception $ex){
              echo 'Caught exception: ',  $ex-&gt;getMessage(), "\n";
              exit;
          }
      }
  </code></pre>