my codeigniter framework wont send emails by smtp. I always return a error that he cannot send the my by smtp over php on this server. If i check my username, host and password by copy and past to login with a webclient into the mailbox, it workds. So i use the correct host, username and password.
I think i have setup something wrong, but i dont know what.
Thats the email_helper
$config['mailpath'] = "/usr/bin/sendmail"; // or "/usr/sbin/sendmail"
$config['protocol'] = "smtp";
$config['smtp_host'] = $settings['smtp_host']; (smtp.domain.com)
$config['smtp_port'] = $settings['smtp_port']; (465)
$config['smtp_timeout'] = '30';
$config['smtp_user'] = $settings['smtp_user']; (email = user)
$config['smtp_pass'] = $settings['smtp_pass']; (my password)
$config['mailtype'] = 'html';
$config['charset'] = 'utf-8';
$config['newline'] = "\r\n";
$config['wordwrap'] = TRUE;
$controller->load->library('email');
$controller->email->initialize($config);
$controller->email->from( $settings['email_from'] , $settings['application_name'] );
$controller->email->to($to);
$controller->email->subject($subject);
$controller->email->message($body);
if($cc != '')
{
$controller->email->cc($cc);
}
if($attachment != '')
{
$controller->email->attach(base_url()."your_file_path/" .$attachment);
}
if($controller->email->send()){
return "success";
}
else
{
echo $controller->email->print_debugger();
}
}
I've chekced the correct values from the $settings array, too.
To send the email i do it in this way
$this->mailer->mail_template($to,'forget-password',$mail_data);
Adding the ssl information solved the problem
$config['smtp_crypto'] = 'ssl';
Related
i have a simple config email for send an email.
$this->load->library('email');
$config['smtp_crypto'] = 'tls';
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'smtp.gmail.com';
$config['smtp_port'] = 587;
$config['smtp_timeout'] = '5';
$config['smtp_user'] = 'hi*****y#gmail.com';
$config['smtp_pass'] = '*****';
$config['charset'] = 'utf-8';
$config['newline'] = "\r\n";
$config['mailtype'] = 'html'; // or html
// $config['validation'] = TRUE; // bool whether to validate email or not
$this->email->initialize($config);
$message = "content";
$this->email->from("hikmatfauzy#gmail.com", "judul");
$this->email->to("hikmatfauzy7#gmail.com");
$this->email->subject("judul");
$this->email->message($message);
$this->email->send();
echo $this->email->print_debugger();
I get this error message below. how can i do?
i tried on my xampp server but running well. but on IIS i got this error.
A PHP Error was encountered
Severity: Warning
Message: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
Filename: libraries/Email.php
Line Number: 1703
NOTE:
I changed $config['smtp_port'] from 465/587/25 (still got the
error).
I changed my php.ini openssl extension (still got the
error).
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'smtp_host';
$config['smtp_port'] = 25;
$config['smtp_user'] = 'smtp_user';
$config['smtp_pass'] = '$$$';
$this->load->library('email', $config);
$this->email->initialize($config);
$this->email->from($config['smtp_user']);
$this->email->to('aaaa#test.com');
$this->email->subject('TEST MAIL');
$this->email->message('TESTING OF MAIL');
if ($this->email->send()) {
return true;
} else {
return false;
}
This is my code for sending email. I got below error.
Message: fsockopen(): unable to connect to box334.bluehost.com:25 (A connection attempt failed because the connected party did not properly
respond after a period of time, or established connection failed
because connected host has failed to respond. )
You email server is not responding properly. try to check your email server setting like smtp PORT, SMTP HOST and USER etc.
i am using php mailer in Codeigniter.
here is my email settings
mail was sending to other email id but not sending to email id which is in office 365.
<?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.office365.com';
$config['smtp_user'] = 'example#example.com';
$config['smtp_pass'] = 'password';
//$config['smtp_port'] = 587;
$config['smtp_timeout'] = 5; // (in seconds)
$config['smtp_crypto'] = 'tls'; // '' or 'tls' or 'ssl'
$config['smtp_debug'] = 4; // PHPMailer's SMTP debug info level: 0 = off, 1 = commands, 2 = commands and data, 3 = as 2 plus connection status, 4 = low level data output.
$config['wordwrap'] = true;
$config['wrapchars'] = 76;
$config['mailtype'] = 'html'; // 'text' or 'html'
$config['charset'] = 'ISO-8859-15'; // 'UTF-8', 'ISO-8859-15', ...; NULL (preferable) means config_item('charset'), i.e. the character set of the site.
$config['validate'] = true;
$config['priority'] = 3; // 1, 2, 3, 4, 5; on PHPMailer useragent NULL is a possible option, it means that X-priority header is not set at all, see https://github.com/PHPMailer/PHPMailer/issues/449
$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;
$config['encoding'] = '8bit'; // The body encoding. For CodeIgniter: '8bit' or '7bit'. For PHPMailer: '8bit', '7bit', 'binary', 'base64', or 'quoted-printable'.
i have the following error
Connection: opening to smtp.office365.com:25, timeout=5, options=array ( ) 2016-01-02 10:00:49 SMTP ERROR: Failed to connect to server: Connection refused (111) 2016-01-02 10:00:49 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting bool(false)
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
same setting are working in other servers, but not working in Go daddy server.
i checked openssl connection was enabled.
There are many duplicates of this question, and it's also covered in the PHPMailer docs: GoDaddy blocks outbound email, so you have to use their mail servers.
Mandrill working fine in my localhost, but not on server. The following SMTP error was encountered: 110 Connection timed out.I'm working in codeigniter.
Here's my email config file :
$config['mailtype'] = 'html';
$config['charset'] = 'utf-8';
$config['priority'] = 1;
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'smtp.mandrillapp.com';
$config['smtp_port'] = '587';
$config['smtp_user'] = 'abcdefgh#gmail.com';
$config['smtp_pass'] = 'xxxxxxxxxxxxxxxxxxxxxx';
The mails are received wen sending from localhost. I tried debugger.and i receive the above error. Please help!!! What could be the reason??
i think the port is blocked, try this in any controller:
$connection = #fsockopen('smtp.mandrillapp.com', 587);
if (is_resource($connection)){
echo 'open';
fclose($connection);
}else{
echo 'closed';
}
i've already had this problem while i'm implementing mandrill on my web app.
Hello I have this code to send mail but mail is not getting sent. I can not send mail from the online server but I can send mail locally. What could be the issue?
$mail = new \Core\mailer\Phpmailer();
$mail->IsSMTP(); // we are going to use SMTP
$mail->SMTPAuth = true; // enabled SMTP authentication
$mail->SMTPSecure = "tls";
$mail->Host = "email-smtp.eu-west-1.amazonaws.com";
$mail->Port = 587; // SMTP port to connect to GMail
$mail->Username = "******"; // user email address
$mail->Password = "*********"; // password in GMail
$mail->SetFrom('upload#irokingdev.com', 'IROKING'); //Who is sending the email
$mail->AddReplyTo('upload#irokingdev.com', 'iROKING Registration');
$mail->Subject = 'Registration on iROKING';
$mail->Body = $body;
$mail->AltBody = "Plain text message";
$destination = $to; // Who is addressed the email to
$mail->AddAddress($destination, "");
if(!$mail->Send()) {
echo "Error: " . $mail->ErrorInfo;
} else {
echo "Message sent correctly!";
}
I'm gonna take a stab at and say that you are probably missing your email address upload#irokingdev.com as a verified email address in Amazon SES.
You can do it from AWS SES console: