Mail sending error, please help me out - El Forum - 07-26-2013
[eluser]sridhar2do[/eluser]
Code in Controller
Code: function sendmsg(){
$config = array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => '[email protected]',
'smtp_pass' => 'abcdefghijk',
'mailtype' => 'html',
'charset' => 'iso-8859-1'
);
$this->load->library('email', $config);
$this->email->from('[email protected]', 'My Company Name');
$this->email->to('[email protected]');
$this->email->subject('Your client Sridhar, Invites you to join our website');
$this->email->message('From now on wants to transact business with you.');
$this->email->send();
echo $this->email->print_debugger();
}
error message:
Code: A PHP Error was encountered
Severity: Warning
Message: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.googlemail.com:465 (Connection timed out)
Filename: libraries/Email.php
Line Number: 1689
and from my mail debugger
The following SMTP error was encountered: 110 Connection timed out
Unable to send data: AUTH LOGIN
Failed to send AUTH LOGIN command. Error:
Unable to send data: MAIL FROM:
from:
The following SMTP error was encountered:
Unable to send data: RCPT TO:
to:
The following SMTP error was encountered:
Unable to send data: DATA
Mail sending error, please help me out - El Forum - 07-27-2013
[eluser]ivantcholakov[/eluser]
See https://github.com/ivantcholakov/codeigniter-phpmailer Try to use this library of mine.
application/config/email.php:
Code: <?php defined('BASEPATH') OR exit('No direct script access allowed.');
$config['useragent'] = 'PHPMailer'; // Mail engine switcher: 'CodeIgniter' or 'PHPMailer'
$config['protocol'] = 'smtp'; // 'mail', 'sendmail', or 'smtp'
$config['mailpath'] = '/usr/sbin/sendmail';
$config['smtp_host'] = 'smtp.gmail.com';
$config['smtp_user'] = '[email protected]';
$config['smtp_pass'] = 'abcdefghijk';
$config['smtp_port'] = 465;
$config['smtp_timeout'] = 5; // (in seconds)
$config['smtp_crypto'] = 'ssl'; // '' or 'tls' or 'ssl'
$config['wordwrap'] = true;
$config['wrapchars'] = 76;
$config['mailtype'] = 'html'; // 'text' or 'html'
$config['charset'] = 'iso-8859-1';
$config['validate'] = true;
$config['priority'] = 3; // 1, 2, 3, 4, 5
$config['crlf'] = "\n"; // "\r\n" or "\n" or "\r"
$config['newline'] = "\n"; // "\r\n" or "\n" or "\r"
$config['bcc_batch_mode'] = false;
$config['bcc_batch_size'] = 200;
And testing within a controller:
Code: $this->load->library('email');
$subject = 'Your client Sridhar, Invites you to join our website';
$message = '<p>From now on wants to transact business with you.</p>';
$body = $this->email->full_html($subject, $message);
$result = $this->email
->from('[email protected]', 'My Company Name') // Send from your Gmail account only.
->reply_to('[email protected]') // This is other account of yours.
->to('[email protected]')
->subject($subject)
->message($body)
->send();
var_dump($result);
echo '<br />';
echo $this->email->print_debugger();
I did a similar test. The setting
Code: $config['useragent'] = 'PHPMailer';
works for me, but with the setting
Code: $config['useragent'] = 'CodeIgniter';
I had no success.
Mail sending error, please help me out - El Forum - 07-31-2013
[eluser]noideawhattotypehere[/eluser]
Isnt gmails smtp port 587? At least thats what im using with ssmtp...
Mail sending error, please help me out - El Forum - 07-31-2013
[eluser]ivantcholakov[/eluser]
[quote author="noideawhattotypehere" date="1375266466"]Isnt gmails smtp port 587? At least thats what im using with ssmtp...[/quote]
A Gmail configuration example, using port 587:
application/config/email.php:
Code: <?php defined('BASEPATH') OR exit('No direct script access allowed.');
$config['useragent'] = 'PHPMailer'; // Mail engine switcher: 'CodeIgniter' or 'PHPMailer'
$config['protocol'] = 'smtp'; // 'mail', 'sendmail', or 'smtp'
$config['mailpath'] = '/usr/sbin/sendmail';
$config['smtp_host'] = 'smtp.gmail.com';
$config['smtp_user'] = '[email protected]';
$config['smtp_pass'] = 'abcdefghijk';
$config['smtp_port'] = 587;
$config['smtp_timeout'] = 5; // (in seconds)
$config['smtp_crypto'] = 'tls'; // '' or 'tls' or 'ssl'
$config['wordwrap'] = true;
$config['wrapchars'] = 76;
$config['mailtype'] = 'html'; // 'text' or 'html'
$config['charset'] = 'iso-8859-1';
$config['validate'] = true;
$config['priority'] = 3; // 1, 2, 3, 4, 5
$config['crlf'] = "\n"; // "\r\n" or "\n" or "\r"
$config['newline'] = "\n"; // "\r\n" or "\n" or "\r"
$config['bcc_batch_mode'] = false;
$config['bcc_batch_size'] = 200;
These are the changed settings in comparison with the previously posted example:
$config['smtp_port'] = 587;
$config['smtp_crypto'] = 'tls';
|