0

I'm currently using SwiftMailer using the following code with no issues:

            $transport = Swift_SmtpTransport::newInstance('inboundsmtp.XXXX.com', 25);
            $mailer = Swift_Mailer::newInstance($transport);

I'm not sure exactly how the authentication works other than that it's tied to the server - ie that server and/or service account has permissions on the exchange server.

In any case, the code above works, but if I try that in Symfony Mailer:

            $mailer = new Mailer(Transport::fromDsn('smtp://inboundsmtp.XXXX.com:25'));

I get the following error: Uncaught Symfony\Component\Mailer\Exception\TransportException: Unable to connect with STARTTLS

I did, through trial and error, discover that THIS works:

            $mailer = new Mailer(Transport::fromDsn('smtp://webmail.XXXX.com:25'));

except when I try to send emails to external addresses I get this error instead: Expected response code "250/251/252" but got code "550", with message "550 5.7.54 SMTP; Unable to relay recipient in non-accepted domain"

Is there any way I can configure Mailer to use inboundsmtp.XXXX.com? It sounds from the error (STARTTLS) that it's trying to use TLS - and perhaps that's the issue. is there a way to force it not to? I find the documentation for Mailer is nowhere near as clear as SwiftMailer was

Any Help would be appreciated

MJC
  • 57
  • 9
  • You need to contact whoever administers the smtp server you are using ("webmail.XXXX.com") and tell them you want to relay from the inboundsmtp.XXXX.com domain and follow their advice. They might flat out say you can't, they might be able to configure their server to allow this, they might give you a special set of credentials you can use. – Bhavin Nakrani Jan 25 '22 at 06:59

1 Answers1

-1

Discovered this works: smtp://inboundsmtp.XXXX.com:25?verify_peer=false

MJC
  • 57
  • 9