So You'd Like to Send Some Email (Through Code)

I had a major issue when I built my first website and had an email submission form with a major security vulnerability. Even though a good contact form is still the best way to go to avoid spam, you really need to know what you’re doing.

@Brad Davis:
I’m not an expert on this, but when I looked into it several years ago, some mail servers operated as black holes to avoid email address harvesting/verification for spams.

I need expert help regarding SMTP…anyone, please!

I’m trying to understand the safest way to use SMTP. I am about to purchase a virtual server package, on which I will set up PHPlist (free open source mailing program), so we have the freedom to send unlimited newsletters (…10,000 per day at least, which requires a VPS).

Here’s my current setup with YMLP’s software. I have a website - let’s call it, MyHostedDomain.com. I send newsletters with the From / Reply To address as alias@SomeoneElsesDomain.com, which isn’t being hosting by me but I have access to the email account.

Can I do this with PHPList? i.e. send messages using alias@SomeoneElsesDomain.com as the visible address, but having it all go through my VPS SMTP? I cannot authenticate it, right? Is this a bad practice? Is my only hope to use an address with a domain on the VPS, i.e. alias@MyHostedDomain.com?

Why don’t use http://www.smtp.com ? This cloud email sending provider will do all this staff for you.

There’s a bug in this code, though. Do you see it?

Yes, the backslashes don’t appear to have survived through the ages. You need to use galvanised backslashes in all code exposed to the Internet elements, or they’ll rust away in no time.

Oops, I sourced the original SO topic and fixed that code. Good catch.