"Relay access denied" error when sending email using CakePHP 1.3 - email

I'm trying to send an email using CakePHP 1.3 and I'm getting this error message:
"SMTP server error: 4.7.1 : Relay access denied"
The code for sending email is as below:
this->set('username',$username);
$this->set('pass',$pass);
$this->Email->fromName = Configure::read('from_team');
$this->Email->to = $to;
$this->Email->subject = 'New Password';
$result = $this->Email->send();
Any ideas?

It was due to invalid SMTP settings. I have detected it and solved it.

Related

Problem sending emails via PHPMailer due to DNS settings

This is my first post so please be gentle.
I've been trying to send automatic SMTP emails via PHPMailer using my webhost as the server. Below is the script I am using.
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
require '../PHPMailer/src/Exception.php';
require '../PHPMailer/src/PHPMailer.php';
require '../PHPMailer/src/SMTP.php';
//Load Composer's autoloader
//require 'vendor/autoload.php';
//Create an instance; passing `true` enables exceptions
$mail = new PHPMailer(true);
try {
//Server settings
$mail->SMTPDebug = 4; //SMTP::DEBUG_SERVER;
$mail->isSMTP();
$mail->Mailer = "smtp";
$mail->Host = 'surrey.redbackinternet.net';
$mail->SMTPAuth = true;
$mail->Username = 'noreply#mydomain.com';
$mail->Password = 'password';
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
$mail->Port = 587;
//Recipients
$mail->setFrom('noreply#mydomain.com', 'xxx');
$mail->addAddress('contact#mydomain.com');
//Content
$mail->isHTML(true);
$mail->Subject = 'Here is the subject';
$mail->Body = 'This is the HTML message body <b>in bold!</b>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
$mail->send();
echo 'Message has been sent';
} catch (Exception $e) {
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}
?>
Previously, I was using Gmail as the server, which worked fine, but now I want to change this. When I run the script with the new details I get authentication error - "SMTP ERROR: Password command failed: 535 Incorrect authentication data". The full PHPMailer script log is shown in the image below.
PHPMailer log
I know the username and passwords used are correct and have seen this error seems to be returned whenever a connection cannot be established. I have a hunch it's related to my email DNS settings, though I could be completely wrong here. When I check my DNS and MX settings using dnschecker.org all seems ok as far as I can naively tell. But using hardenize.com I see my domain fails their mail server and email TLS checks. The information provided is lacking but it does say "A network error occurred while we were trying to communicate with a server. Error message: java.net.SocketTimeoutException: Read timed out". I should add here that my site uses Cloudflare as a CDN.
Any ideas on what the issue is or how to resolve it?
Thanks in advance.

Send mail in C# without Password

I send email using below code. Its working fine. But how to send email without password. If I give empty string in senderPassword, I got below error
"Additional information: Transaction failed. The server response was: 5.7.1 : Client host rejected: Access denied".
I googled and found similar questions, but I didn't get correct solution. Please help me to solve this.
SmtpClient smtp = new SmtpClient();
smtp.Port = 587;
smtp.Host = "myhost.com";
smtp.EnableSsl = true;
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.Credentials = new System.Net.NetworkCredential(senderID, senderPassword);
smtp.Timeout = 30000;
MailMessage message = new MailMessage(senderID, To, Subject, Body);
smtp.Send(message);
You need to change the authentication on the SMTP server. If you don't own the SMTP server then this is out of your control.

454 Error: authentication failed when using Net::SMTP::SSL to send email

I use Net::SMTP::SSL to sent email in Perl, and got "454 Error: authentication failed"
Here is my code:
use Net::SMTP::SSL;
$smtp = Net::SMTP::SSL->new($smtp2, Port => $smtp_port2, Timeout => 10, Debug => 1);
$smtp->auth($login2, $password2);
$smtp->mail($login2);
$smtp->to($to);
$smtp->data();
$smtp->datasend("To: $to\n");
$smtp->datasend("From: Aspiring error email \n");
$smtp->datasend("Date: $today\n");
$smtp->datasend("Subject: $subject\n");
$smtp->datasend("\n");
$smtp->datasend($message);
$smtp->dataend();
$smtp->quit;
And i got these message:
Net::SMTP::SSL=GLOB(0xf9ab80)<<< 454 Error: authentication failed, system busy
It seem i failed to auth, and i am sure the username and pw is correct.
Thanks so much!!!
454 Error: authentication failed, system busy
These are temporary problems.
The mail server is probably not doing local verification of the password, but is using an external system like a Radius or LDAP server, and the connection to this authentication system failed. Just try again later and hope that the problem got resolved.
If the credentials were wrong the server would have send a 535 status code.
See also the status codes in RFC4954.

visual basic gmail submission not working

I have the following piece of code which does not seem to work. The error message is below the code.
Dim smtpserver As New SmtpClient()
Dim mail As New MailMessage()
smtpserver.Credentials = New Net.NetworkCredential("myemail#gmail.com", "mypassword")
smtpserver.Port = 465
smtpserver.Host = "smtp.gmail.com"
mail = New MailMessage()
mail.From = New MailAddress("myemail")
mail.To.Add("myemail#gmail.com")
mail.Subject = "Test"
mail.Body = "testing "
smtpserver.Send(mail)
MsgBox("Mail Sent")
Here is the error message:
The SMTP server requires a secure connection or the client was not authenticated.
The server response was:
5.7.0 Must issue a STARTTLS command first.
w6sm4604909qas.26 - gsmtp
What does this mean? Why is this not working?
Gmail does not accept unencrypted and/or unauthenticated email submission. Your code needs to use STARTTLS like the error message states, and authenticate before trying to send anything.

email not sent in cronjob sugarCRM

I have set email settings using gmail from my localhost successfully and my sugar instance is sending test mail well. I also done with cron job setup and tested it.
The problem occurs when i try to send email in a cron job it cannot be send. My basic code i am using is
require_once('include/SugarPHPMailer.php');
$emailObj = new Email();
$defaults = $emailObj->getSystemDefaultEmail();
$mail = new SugarPHPMailer();
$mail->setMailerForSystem();
$mail->From = $defaults['email'];
$mail->FromName = $defaults['name'];
$mail->Subject=from_html($bean->name);
$mail->Body="hello this is testing ....!";
$mail->prepForOutbound();
$mail->AddAddress('abc#yahoo.com');
#$mail->Send();
The following errors displayed in fatal log .
09/24/12 10:58:07 [4560][1][FATAL] SMTP -> ERROR: EHLO not accepted from server. Code: , Reply:
09/24/12 10:58:07 [4560][1][FATAL] SMTP -> ERROR: HELO not accepted from server. Code: , Reply:
09/24/12 10:58:07 [4560][1][FATAL] SMTP -> ERROR:AUTH not accepted from server. Code: Reply:
09/24/12 10:58:07 [4560][1][FATAL] SugarPHPMailer encountered an error: SMTP Error: Could not authenticate.
09/24/12 10:58:07 [4560][1][FATAL] SugarPHPMailer encountered an error: SMTP Error: Could not connect to SMTP host.
09/24/12 10:58:07 [4560][1][FATAL] SugarPHPMailer encountered an error: An outgoing mail server is not configured to send emails. Please configure an outgoing mail server or select an outgoing mail server for the mail account that you are using in Settings >> Mail Account.
Some time it give follwing one,
09/24/12 11:01:07 [832][1][FATAL] SugarPHPMailer encountered an error: Language string failed to load: tls
can anybody help please?