SwiftMailer permission error when sending email

I am using the SwiftMailer extension (http://www.yiiframework.com/extension/mail) and I have set it up as follows:














But for some reason I am receiving the following error message on the page:

Error 500

fsockopen() [<a href=‘function.fsockopen’>function.fsockopen</a>]: unable to connect to mail.mysmtp.com:25 (Permission denied)

It may well be a server error but I can’t figure out what it is…


Do you expect it to work when you left the defaults as-is? :)

Unless you really have a smtp host called mail.mysmtp.com and a password which matches me@mycompany.com, then it will definitely fail. ;D

First, try setting the transport type to ‘php’:

'transportType' => 'php',

And remove/comment out the transportOptions.

No man, I changed those values in my post so that I don’t expose my mail server/account information!

I will try with PHP now.

That was clever. :lol:

Then it definitely works. But the mail server is rejecting you.

Maybe the wrong port?

The problem was on the hosting server, which had a firewall blocking external hosts, or something like that. They have added the IP addresses to their allowed list and it’s working fine now.

it is not working for transport type php…please help