I\'m using PHP Swift_mailer library to send emails to my customers\' clients from behalf of customers. I use their SMTP server, port, login, pass:
$transport = S
It's because of your SMTP server. Not the server that runs PHP. The SMTP server is blocked by the destination mail server. For making sure of it, if you change your settings (in PHP code) with Gmail server, it won't go to the spam folder any more.
It worked pretty well for a few months, but now the emails started to appear in a Spam folder for some of my customers?
That's because the destination mail server has added your SMTP server to their blacklist.
If you've not done so already, you might want to setup an SPF record for the domain that you are sending from, to indicate that the sending mail server's IP is authorized to send mail for your domain. If you don't already have an SPF record setup, this might solve the problem.
Also - To see if the outgoing SMTP server that you are using has a glaring problem that would cause receiving mail servers to think it's a spammer, try sending a message from your application through your outgoing SMTP server to check-auth@verifier.port25.com. This service will do a bunch of checks, and you'll get a report back with ton of information, such whether or not your mail server's DNS is setup correctly, whether your mail server's IP is on any black lists, if you have a problem with your SPF records, etc.