I have install suiteCRM on my server.
I have configured the email smtp server on email module and it's work great.
I have put the same configuration informations in "set up email" in the campaign module.
I have add the cron command on my server.
But when i create a campaign the email stay in queue. I have a log error :
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Sun Apr 16 22:53:14 2017 [25545][1][FATAL] SugarPHPMailer encountered an error: Vous n'avez pas configuré le serveur SMTP pour votre compte Mail. Configurer ou choir le serveur SMTP pour le compte Mail.
Sun Apr 16 22:53:14 2017 [25545][1][FATAL] SugarPHPMailer encountered an error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Sun Apr 16 22:53:14 2017 [25545][1][FATAL] Email delivery FAILURE:Array
I have tried to turn off firewall => it doesn't work
I have tried to change php version (5.6=> 5.5) => it doesn't work
Any ideas ?
Thanks.
I have found a very crappy solution, it's work if you can send email from localhost without smtp external account :
Edit the file /modules/EmailMan/EmailManDelivery.php :
Comment email outbound setting from line 220 to 249 :
// if user want to use an other outbound email account to sending...
// if ($current_emailmarketing->outbound_email_id) {
// $outboundEmailAccount = BeanFactory::getBean('OutboundEmailAccounts',
// $current_emailmarketing->outbound_email_id);
//
// if (strtolower($outboundEmailAccount->mail_sendtype) == "smtp") {
// $mail->Mailer = "smtp";
// $mail->Host = $outboundEmailAccount->mail_smtpserver;
// $mail->Port = $outboundEmailAccount->mail_smtpport;
// if ($outboundEmailAccount->mail_smtpssl == 1) {
// $mail->SMTPSecure = 'ssl';
// } elseif ($outboundEmailAccount->mail_smtpssl == 2) {
// $mail->SMTPSecure = 'tls';
// }
// if ($outboundEmailAccount->mail_smtpauth_req) {
// $mail->SMTPAuth = true;
// $mail->Username = $outboundEmailAccount->mail_smtpuser;
// $mail->Password = $outboundEmailAccount->mail_smtppass;
// }
// } else {
// $mail->Mailer = "sendmail";
// }
//
// $mail->oe->mail_smtpauth_req = $outboundEmailAccount->mail_smtpauth_req;
// $mail->oe->mail_smtpuser = $outboundEmailAccount->mail_smtpuser;
// $mail->oe->mail_smtppass = $outboundEmailAccount->mail_smtppass;
// $mail->oe->mail_smtpserver = $outboundEmailAccount->mail_smtpserver;
// $mail->oe->mail_smtpport = $outboundEmailAccount->mail_smtpport;
// $mail->oe->mail_smtpssl = $outboundEmailAccount->mail_smtpssl;
// }
And add this lines :
$mail->Mailer = "sendmail";
$mail->SMTPSecure = 'ssl';
$mail->SMTPAuth = true;
It's work for me.
Looking forward to a better solution
Related
I am trying to send mail using PHPMailer but when i try i get error like
MEssage Could not be sent. SMTP connect() failed
When i debug the code, I got following message:
CLIENT -> SERVER: EHLO 127.0.0.1
CLIENT -> SERVER: AUTH LOGIN
CLIENT -> SERVER: dGFsYWFzaDIwMTdAc29jZXQuZWR1Lmlu
CLIENT -> SERVER: c29jZXRAMTIz
SMTP ERROR: Password command failed: 534-5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbt5534-5.7.14 V4dQliEGa4GCkfkxZoZVAX296_Q1jP9UHhiGXQShhTqxshYg2snLu2nKW4UIhB3k4X6Kqt534-5.7.14 Q6rvXHk5aNrXU22BwfYC_VVWeFwr8-216IZQmLpq0AA9NXNaQGQHeW1ZJNQGrvUBs6f8HQ534-5.7.14 OLspMG5dlPjNzvsAGG6lHHJ7eVYFFv8sZEYvxaAkvJR1zHk27qNpB1Gc5Ld32Fbs1SpC2H534-5.7.14 981OqnvjQrzYQCbcwIwVrqfjoVQPk> Please log in via your web browser and534-5.7.14 then try again.534-5.7.14 Learn more at534 5.7.14 https://support.google.com/mail/answer/78754 n79sm9364629pfj.31 - gsmtp
SMTP Error: Could not authenticate.
CLIENT -> SERVER: QUIT
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Message could not be sent.Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Below is the code which i have tried:
require '../phpmailer/PHPMailerAutoload.php';
$mail = new PHPMailer;
//$mail->SMTPDebug = 3; // Enable verbose debug output
$mail->isSMTP();
$mail->SMTPDebug = 1;
$mail->Debugoutput = 'html';
$mail->Host = 'smtp.gmail.com';
$mail->Port = 465;
$mail->SMTPSecure = 'ssl';
$mail->SMTPAuth = true;
$mail->Username = 'mymail#gmail.com'; // SMTP username
$mail->Password = 'mypass';
$mail->setFrom('mymail#gmail.com', 'Mailer');
$mail->addAddress($user_email, $user_name);
$mail->Subject = 'Registration acknowledgment GTU Techfest Zone - 1';
$mail->Body = '<b>You have registerd for following events:</b>'."\r\n";
if(!$mail->send())
{
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}
}
else
{
echo "unsuccessfull".mysql_error();
}
I have tried several solutions but its not working. I am working on localhost.I have also changed my xampp settings to send mail
From my localhost, i cannot send email using gmail account. I've Used php 7.0.9 and codeigniter. I wrote the code in controller is-
$this->load->library('email');
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.googlemail.com';
$config['smtp_port'] = '25';
$config['smtp_user'] = 'xxx#gmail.com';
$config['smtp_pass'] = 'password';
$config['charset'] = 'utf-8';
$config['newline'] = "\r\n";
$config['mailtype'] = 'html';
$config['wordwrap'] = TRUE;
$this->email->initialize($config);
$this->email->from('xxx#gmail.com');
$this->email->to('aaaa#yahoo.com');
$this->email->subject("Welcome to xx.");
$this->email->message('message body.....');
if ($this->email->send()) {
$data['success'] = 1;
} else {
$data['success'] = 0;
$data['error'] = $this->email->print_debugger(array('headers'));
}
echo "<pre>";
print_r($data);
echo "</pre>";
But I got the error
Array
(
[success] => 0
[error] => The following SMTP error was encountered: 0
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
data:
The following SMTP error was encountered:
Unable to send data: User-Agent: CodeIgniter
Date: Wed, 26 Oct 2016 12:10:08 +0200
Anyone please give me suggestion about it.
i'm trying to send an email using phpmailer, it works fine on my laptop using xampp localhost server but when i tried to run the php class on my windows server 2008 with wamp installed on it it didn't work.
i already checked if the ssl is enabled from the php.ini
i'm getting this error:
2016-09-06 10:01:22 Connection: opening to smtp.mail.yahoo.com:587, timeout=300, options=array ( ) 2016-09-06 10:01:44 SMTP ERROR: Failed to connect to server: 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. (10060) 2016-09-06 10:01:44 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting Message could not be sent.Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
here's my code:
SendOutlook();
function SendOutlook(){
//$recipient = 'alghomlas.dk#pg.com';
require 'PHPMailer/PHPMailerAutoload.php';
$Emp_recipient = "alghomlas.dk#pg.com";
$mail = new PHPMailer;
$mail->SMTPDebug = 4; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = "smtp.mail.yahoo.com"; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'xxxxxxxxx'; // SMTP username (server username)
$mail->Password = 'xxxxx'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587; // TCP port to connect to
$mail->setFrom('alghomlas.dk#yahoo.com', 'One');
$mail->addAddress($Emp_recipient,"dalal alghomlas"); // Add a recipient
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'test';
$mail->Body = "scheduled on your outlook calender";
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
exit();
}else {
echo '<p>Message has been sent</p>';
}
echo !extension_loaded('openssl')?"Not Available":"Available";
AddOutlookEvent($Mng_recipient, $Emp_recipient, $Mng_Name, $Emp_Name, $Date, $Time);
}
I'm having troubles sending an email with PHPMailer through my SMTP which is ssl enabled.
$mail = new PHPMailer;
// HTML email!
$mail->IsHTML(true);
$mail->isSMTP();
$mail->SMTPDebug = 0;
//Ask for HTML-friendly debug output
$mail->Debugoutput = 'html';
//Set the hostname of the mail server
$mail->Host = "server.co.tz";
//Set the SMTP port number - likely to be 25, 465 or 587
$mail->Port = 465;
$mail->SMTPSecure = "ssl";
//Whether to use SMTP authentication
$mail->SMTPAuth = true;
//Username to use for SMTP authentication
$mail->Username = "xxxxxxx";
//Password to use for SMTP authentication
$mail->Password = "yyyyyyy";
When i run the script I get the following error:
Mailer Error: SMTP connect() failed.
And on the exim4 logs:
2016-02-24 11:02:20 TLS error on connection from [197.215.254.114] (gnutls_handshake): A TLS fatal alert has been received.
I have no clue on what is going wrong here.
I use the SMTP regurarly for my email clients and the SSL certificate is a valid one.
Update:
Got latest version and set debug to 3 but still no luck:
Connection: opening to ssl://fsm.co.tz:465, timeout=300, options=array ()
SMTP ERROR: Failed to connect to server: (0)
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
As of today #PHPMailer version 6.1.4
These worked for me:-
$email->SMTPDebug = SMTP::DEBUG_SERVER;
$email->isSMTP();
$email->Host = 'host';
$email->SMTPAuth = true;
$email->Username = 'username';
$email->Password = 'password';
$email->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;
$email->Port = 465;
The solution is to add the following to the configuration:
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => false
)
);
I have a problem with phpmailer takes about 5 seconds to send 10 emails, I think that is a long time, because I need to send some 100 or 200 emails and the script takes too long and I get error 500.
Work with maybe 10 or 20 emails, but if i have more show error.
Need help please.
Note: $email2 is array emails.
require 'smtp/PHPMailerAutoload.php';
$mail = new PHPMailer;
//$mail->SMTPDebug = 2; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = "localhost"; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'contacto#xxx.com'; // SMTP username
$mail->Password = 'password'; // SMTP password
$mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted
$mail->SMTPKeepAlive = true; // SMTP connection will not close after each email sent, reduces SMTP overhead
$mail->Port = 465; // TCP port to connect to
$mail->CharSet = 'UTF-8';
$mail->setFrom('contacto#xxx.com', 'Website');
$mail->Subject = 'Se ha actualizado tu serie favorita';
$mail->AltBody = 'Para ver este mensaje, use un visor de email compatible con HTML!';
$mail->addReplyTo('contacto#xxx.com');
$mail->isHTML(true);
$mail->Body = 'The Body is HTML Code';
if($vtitle == "Existe") {
foreach($email2 as $email3)
{
$mail2 = clone $mail;
$mail2->addAddress(''.$email3.''); // Add a recipient
$envio = $mail2->send();
}
} else {
echo "El Capitulo no Existe";
}
if(!$envio) {
echo 'El Mensaje no ha podido enviarse.';
echo 'Error: ' . $mail2->ErrorInfo;
} else {
echo 'El Mensaje ha sido enviado.';
}
If I change SMTPAuth to False for not authentication is the same problem.