-1

I am running small social site. It's witten in PHP (but it is not that relevant in this case).

My plan was to make it more popular by allowing registered users to be notified about certain events happening in the site (like "someone commented your content" and so).

Currently my site is sending only simple mails (like welcome mail with confirmation link) via SMTP (Gmail). Unfortunatelly Gmail has some limits - 2000 mails per day (in paid version).

So the next step would be to use something which would allow me to send more mails than 2000 daily. There are paid services like AuthSMTP, Sendgrid, but I prefer to setup something on my own. Something which would be used for sending more than 2000 mails from "no-reply@example.com" to registered users.

So my question is: Is it good option to setup MTA (Mail Transfer Agent) to send mails from php social site? Or should I go different way?

Basically I was thinking about setting up Postfix.

nrph
  • 335
  • 7
  • 18

1 Answers1

3

First of all, e-mail is not an easy of a subject as it may seem. While running your own MTA is something you should consider, it's not always the best solution (depends on your business requirements). There's a lot of services, despite being paid ones, that will probably suffice for your needs, for now.

If you do decide that you want to run your own MTA, here's a few things you should consider:

  1. Run Sendmail or Postfix - it's a matter of preference if you're sending a reasonable amount of email. But over 10 emails a second, go with Postfix (that's 864,000 emails per day).

  2. If you end up running Postfix and you have multiple IP addresses available, you can setup a cronjob that changes the IP address in Postfix's configuration file and send a SIGHUP signal to the program. This will make Postfix start using the different IP address for sending mail and gets around a few restrictions for IP's like MSN who don't allow more than x emails delivered to them in a certain timespan without considering them spam.

  3. Spamassasin - Use it to scan your messages before sending them, if for some reason your server is infected with a spam spreading virus, you'll be thankful you have it (instead of then begging the blacklists to remove you).

  4. Sign up for whitelist programs or delivery tracking programs with various IPS's, such as Microsoft's Postmaster.

  5. Keep an eye on blacklists and ensure that your IP(s) are not listed on them. There are a lot of them but monitoring the major ones should suffice.

  6. You'll need to properly setup reverse DNS and possibly some SPF records if you want to send mail on behalf of another domain or subdomain.

  7. Use a good PHP library for sending mail, such as SwiftMailer or any other of your preference.

Hope this helps!

EDIT:

Now that you mention it in the comments, also please read, very carefully: 2003 CAN-SPAM Act

Andre
  • 3,150
  • 23
  • 23
  • Take a special look at #4 on the list above. That can be a real pain in the neck. It was very common for my company to get blacklisted because people would subscribe and then they would mark the email they subscribed for as junk. Our biggest problem was AOL because we'd get blacklisted soon after their users clicked that junk button. – Trever Shick Dec 26 '10 at 00:14
  • @Trever: I broke your comment, changed #4 to #5 :P – Andre Dec 26 '10 at 00:17
  • @Trever - I was thinking to put link to disable notifications in the mail footer. Would this be sufficient to avoid such problems? – nrph Dec 26 '10 at 00:20
  • @Andre - it's really not that easy like it seems... So what would you choose in this topic? Let's say the estimation would be 50 000 mails monthly, but it might increase as we will do some marketing campaing soon. – nrph Dec 26 '10 at 00:33
  • For that amount of email, go with an email provider, unless you want to learn _a lot_ more about email and wish to handle this task yourself. For 50,000 emails you can probably find something in the range of $100-$200 a month, worry free (which is worth more than that I think). – Andre Dec 26 '10 at 00:39
  • I would add that if your hosting is shared, you'll likely end up with the IP blacklisted because of other accounts fraudulent activity and is better to try to move to non-shared hosting solution. Unfortunately, large blocks of IPs from non-shared hosting are also black listed because what the previous IP owner did... – Remus Rusanu Dec 26 '10 at 02:35
  • Currently i'm on a german vps, but have access to dedicated servers as well. My hosting provider is VERY strict about spam, so I doubt about previous blacklisting events in this case. – nrph Dec 26 '10 at 08:05
  • There is interesting advice in other question to use GAE to send mails: http://stackoverflow.com/questions/3113131/sending-mass-mail-without-going-insane-sendgrid-cloud/3113323#3113323 – nrph Dec 26 '10 at 08:23
  • @nrph the 'disable notifications' link really never helped us. it's easier for them to click 'junk' than to look for your link :( – Trever Shick Jan 01 '11 at 20:43