I'm using symfony. I want to send mail. On dev mode, I'm using a specific SMTP server which is working fine, but on production: I have an SMTP server which is not with auth, and require a proxy to use.
My code is:
$mailer->send((new Email())->from("[email protected]")
->to("[email protected]")
->subject("Subject")
->html("Here is my content"));
In my .env I have the value of MAILER_DSN which is like smtp://from%40my-email.com:@smtp.my-email.com:25.
I get this error:
Expected response code "220" but got code "554", with message "554 5.7.1 <unknown[1.2.3.4]>: Client host rejected: Access denied".
I searched how to add a proxy, but symfony documentation is only about the reverse proxy for thing like cloudflare client-side (here I want something server side).
How can I add a proxy to fix it?
Haven't done it myself, but I'm guessing the following way:
symfony/http-clientwith config like default or scoping client:smtp-proxy://...So, the code like
$mailer->send((new Email())...will not change, just Transport instance with proxy http-client will be used inside it.