Symfony/PHP Mailer / PHPmailer error during sending : Sender address rejected code: 550 Additional SMTP info: 5.1.8

I have a simple form in Symfony 5, I installed package symfony/mailer and all the time I have strange errors when I trying to send mail. The first time I have an error that I sending spam and my message is blocked, now I have this:

Expected response code "250" but got code "550", with message "550 5.1.8 Sender address rejected".

MailerController:

<?php
 
namespace AppController;
 
use AppFormMailerType;
use SymfonyBundleFrameworkBundleControllerAbstractController;
use SymfonyComponentHttpFoundationRequest;
use SymfonyComponentMimeEmail;
use SymfonyComponentRoutingAnnotationRoute;
use SymfonyComponentMailerMailerInterface;
use SymfonyComponentHttpFoundationResponse;
 
class MailerController extends AbstractController
{
    /**
     * @Route("/email", name="mailer")
     * @param MailerInterface $mailer
     * @return Response
     */
    public function sendEmail(Request $request, MailerInterface $mailer)
    {
        $form = $this->createForm(MailerType::class);
        $form->handleRequest($request);
 
        if ($form->isSubmitted() && $form->isValid()) {
 
            $contactFormData = $form->getData();
            $email = (new Email())
                ->from('[email protected]')
                ->to('[email protected]')
                ->subject('Time for Symfony Mailer!')
                ->text('Sending emails is fun again!');
 
            $mailer->send($email);
            return $this->redirectToRoute('mailer');
        }
        return $this->render('mailer/index.html.twig', [
            'our_form' => $form->createView()
        ]);
    }
}

Conf in .env.local:

'MAILER_DSN' => 'smtp://[email protected]:[email protected]:465',

I make some test php app out of the symfony index.php:

<?php
 
echo "test poczty<br><br>";
use PHPMailerPHPMailerPHPMailer;
use PHPMailerPHPMailerException;
require('src/Exception.php');
require('src/PHPMailer.php');
require('src/SMTP.php');
 
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 3;
$mail->SMTPAuth = TRUE;
$mail->SMTPSecure = "ssl";
$mail->Port     = 465;  
$mail->Username = "[email protected]";
$mail->Password = "haslo";
$mail->Host     = "serwer00000.home.pl";
$mail->Mailer   = "smtp";
$mail->SetFrom('[email protected]');
$mail->AddAddress("[email protected]");    
$mail->Subject = "KONTAKT";
$mail->WordWrap   = 80;
$mail->Subject = "Testowa wiadomość SMTP"; /* Tytuł wiadomości */
$mail->Body = "Witaj, Jeżeli to czytasz, to znaczy, że udało się poprawnie wysłać e-maila za pomocą SMTP!";
 
 
$mail->IsHTML(true);
 
if(!$mail->Send()) {
    echo "<p class='error'>Problem in Sending Mail.</p>";
} else {
    echo "<p class='success'>Contact Mail Sent.</p>";
} 


logs:

test poczty

2020-11-23 11:04:37 Connection: opening to ssl://serwer00000.home.pl:465, timeout=300, options=array()
2020-11-23 11:04:37 Connection: opened
2020-11-23 11:04:37 SERVER -> CLIENT: 220 cloudserver3195961-3195992.home.pl ESMTP IdeaSmtpServer 0.83.520 ready.
2020-11-23 11:04:37 CLIENT -> SERVER: EHLO localhost
2020-11-23 11:04:38 SERVER -> CLIENT: 250-cloudserver3195961-3195992.home.pl Hello 89-67-.xxx.xxx.dynamic.chello.pl [89.67.xxx.xxx], pleased to meet you250-PIPELINING250-ENHANCEDSTATUSCODES250-SIZE250-8BITMIME250-AUTH PLAIN LOGIN250-AUTH=PLAIN LOGIN250 HELP
2020-11-23 11:04:38 CLIENT -> SERVER: AUTH LOGIN
2020-11-23 11:04:38 SERVER -> CLIENT: 334 VXNlcm5hbWU6
2020-11-23 11:04:38 CLIENT -> SERVER: [credentials hidden]
2020-11-23 11:04:38 SERVER -> CLIENT: 334 UGFzc3dvcmQ6
2020-11-23 11:04:38 CLIENT -> SERVER: [credentials hidden]
2020-11-23 11:04:38 SERVER -> CLIENT: 235 2.7.0 User pz+pz.serwer00000logged in.
2020-11-23 11:04:38 CLIENT -> SERVER: MAIL FROM:<[email protected]>
2020-11-23 11:04:38 SERVER -> CLIENT: 550 5.1.8 Sender address rejected
2020-11-23 11:04:38 SMTP ERROR: MAIL FROM command failed: 550 5.1.8 Sender address rejected
The following From address failed: [email protected] : MAIL FROM command failed,Sender address rejected,550,5.1.8SMTP server error: MAIL FROM command failed Detail: Sender address rejected SMTP code: 550 Additional SMTP info: 5.1.8
Problem in Sending Mail.

2020-11-23 11:04:38 CLIENT -> SERVER: QUIT
2020-11-23 11:04:38 SERVER -> CLIENT: 221 2.0.0 Goodbye.
2020-11-23 11:04:38 Connection: closed

I found a similar topic here, the author also had hosting at home.pl : Errors of the SMTP server
And he said : "The problem was in my hosting"
So what i need to find on my hosting ? Some spam filters ? Where is a problem… ?

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *