• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Gmail SMTP using SSL/TLS

#31
[eluser]Unknown[/eluser]
VALID FOR CodeIgniter 2:

Code:
$this->load->library('email');
            
$config['protocol'] = "smtp";
$config['smtp_host'] = "ssl://smtp.googlemail.com";
$config['smtp_port'] = "465";
$config['smtp_user'] = "[email protected]";//also valid for Google Apps Accounts
$config['smtp_pass'] = "your_gmail_pass";
$config['charset'] = "utf-8";
$config['mailtype'] = "html";
$config['newline'] = "\r\n";

$this->email->initialize($config);        
        
$this->email->from('[email protected]', 'YOUR_NAME');
$list = array('[email protected]', [email protected]',[email protected]','[email protected]');
$this->email->to($list);
$this->email->subject('TESTING GMAIL');
$this->email->message('<h1>TEXT MSG<h1>'); //Your cool html5 ;P
$this->email->set_alt_message(strip_tags('<h1>TEXT MSG<h1>')); //Only text
        
if ( ! $this->email->send())
{
show_error($this->email->print_debugger());
} else {
echo('DONE');        
}

Previous: $this->load->library('email', $config_array), and so on hangs & does not work on codeigniter 2

cheers!

#32
[eluser]Unknown[/eluser]
it doesn't work for me, i get this error:
Code:
An Error Was Encountered

220 mx.google.com ESMTP e9sm324285ann.50

hello: 250-mx.google.com at your service, [72.29.67.226]
250-SIZE 35882577
250-8BITMIME
250-AUTH LOGIN PLAIN XOAUTH
250-ENHANCEDSTATUSCODES
250 PIPELINING

from: 250 2.1.0 OK e9sm324285ann.50

to: 553-5.1.2 We weren't able to find the recipient domain. Please check for any
553-5.1.2 spelling errors, and make sure you didn't enter any spaces, periods,
553 5.1.2 or other punctuation after the recipient's email address. e9sm324285ann.50

The following SMTP error was encountered: 553-5.1.2 We weren't able to find the recipient domain. Please check for any 553-5.1.2 spelling errors, and make sure you didn't enter any spaces, periods, 553 5.1.2 or other punctuation after the recipient's email address. e9sm324285ann.50 .....
i'm using CodeIgniter V2.0.2, help!!

#33
[eluser]sophistry[/eluser]
hi rodrigortiz welcome to CI...

did you try to change the recipient domain:
"We weren't able to find the recipient domain" is what google is telling you to do. if you are reaching google mail server and it gives you a coherent error message you should try to understand that. it looks like CI is functioning properly.

cheers.

#34
[eluser]Unknown[/eluser]
Thanks @wrs, this is worked for me.
but, when I receive the email, the sender is always set to my "smtp_user" which is my gmail account,
whatever I put in:
$this->email->from('[email protected]', 'YOUR NAME');
"[email protected]" appear in "reply-to" not in "from".
any help?

#35
[eluser]Unknown[/eluser]
This blog helps me a lot.
Special thanks to all for creating such helping blog.
Thank you very much wrs.

#36
[eluser]Unknown[/eluser]
Perhaps this is the last time am trying using gmail, i have tried the same solution for nearly two weeks and there is no hope of getting it right.

Below is my code

Code:
$config = Array(
                'protocol' => "smtp",
                'smtp_host' => "ssl://smtp.googlemail.com",
                'smtp_port' => 465,
                'smtp_user' => "[email protected]",
                'smtp_pass' => "my-pass",
                'smtp_timeout' => "40",
                'mailtype'  => "text",
                'charset'   => "utf-8",
                'send_multipart'=> TRUE
            );
            $this->load->library('email');
            $this->email->initialize($config);
            $this->email->set_newline("\r\n");


            $this->email->from($this->session->userdata('email'), ucwords($name));
            $this->email->to('[email protected]');
            $this->email->cc($this->session->userdata('email'), ucwords($name));

            $this->email->subject($subject);
            $this->email->message($message);
            $this->email->attach($file_path);
              ...........

OUT PUT BELOW

Unable to send email using PHP mail(). Your server might not be configured to send mail using this method.

From: "my-name" <[email protected]>
Return-Path: <[email protected]>
Cc: [email protected]
Reply-To: "my-name" <[email protected]>
X-Sender: [email protected]
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <[email protected]>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="B_ATC_53676ad1ce320"


=?utf-8?Q?Application_for_The_standard_Lorem_Ipsum_passage_used_since_th?=
=?utf-8?Q?e_1500s?=
This is a multi-part message in MIME format.
Your email application may not support this format.

--B_ATC_53676ad1ce320
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

Am using MAMP installed on mac os

#37
[eluser]Musaddiq Khan[/eluser]
I've used the following code, but not getting any result...

Code:
$config = Array(
  'protocol' => 'smtp',
  'smtp_host' => 'ssl://smtp.googlemail.com',
  'smtp_port' => 465,
  'smtp_user' => '[email protected]', // change it to yours
  'smtp_pass' => 'mypass', // change it to yours
  'mailtype' => 'html',
  'charset' => 'iso-8859-1',
  'wordwrap' => TRUE
);

      $message = 'Hello this is test message...';
      $this->load->library('email', $config);
      $this->email->set_newline("\r\n");
      $this->email->from('[email protected]'); // change it to yours
      $this->email->to('[email protected]');// change it to yours
      $this->email->subject('Resume from JobsBuddy for your Job posting');
      $this->email->message($message);
      if($this->email->send())
     {
      echo 'Email sent.';
     }
     else
    {
     show_error($this->email->print_debugger());
    }

#38
[eluser]CroNiX[/eluser]
@Musaddiq Khan please don't post in multiple places for the same problem. I answered your first post.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.