Hacker News new | past | comments | ask | show | jobs | submit login
So You'd Like to Send Some Email (Through Code) (codinghorror.com)
88 points by giu on April 21, 2010 | hide | past | favorite | 14 comments



Or just use one of the many services that solves these problems for you, like http://authsmtp.com, http://sendgrid.com, http://postmarkapp.com.


Some of us like to be in control of our data and/or not pay others for what is essentially free.

Also, I am not sure how third party email sending services can avoid having me setup a SPF record — as for the PTR record, it’s a good thing to have even if you do not plan to use the IP for sending emails.


Email that's hard is free. Email made easy costs something.


If you use squirrelmail, you can send messages with wget. This avoids many anti-spam and configuration issues.

wget --save-cookies cookies.txt --keep-session-cookies --post-data 'login_username=username&secretkey=password' http://webmail.server.com/src/redirect.php

wget --load-cookies cookies.txt --post-data 'body=body here&send_to=recipient%40wherever.com&subject=subject here&send=1' http://webmail.server.com/src/compose.php

For a bit more, see:

http://mikemccabe.wordpress.com/2007/08/07/sending-email-wit...


This is all fine but what he's talking about is server and DNS configuration, not "There's a bug in this code, though. Do you see it?"


If I wrote that code, I'd be pissed off.


Here's the original on SO http://stackoverflow.com/questions/1200882/ - the author looks pretty angry in his photo! :-)


Also, by default in PHP e-mail subjects and other headers containing non-ASCII chars will not be properly encoded. Here's my way of getting things to work: http://igorpartola.com/web-development/proper-way-to-send-e-...


If you are sending mail with PHP and have UTF-8 content in the subject, recipient name or body, the fEmail class (http://flourishlib.com/fEmail) can handle it all. It supports most common email usage patterns, including HTML content, attachments, S/MIME and sending via SMTP with or without authentication.

It doesn't require any non-standard PHP extensions unless you want to use S/MIME, in which case it requires openssl.


What you are describing isn't a code problem, but an infrastructure one - a useful network has an MTA for just such outgoing mails, with all the anti-spam bases covered. All the various applications and servers that need to send mail will smarthost to that.


I read some people use the Google SMTP server to send their emails (when they use Google Apps for your domain).

What would be the benefits for me to use MailChimp / AuthSmtp / SendGrid / PostMark? Where do I get the best chances to have my emails reach destination?

Thanks


Sending emails has always been a problem for me. The email either gets placed in their spam box (people with aol and yahoo) or the email never arrive there at all (people with comcast and sbc emails). Does anyone have more additional information on how to fix this?


Comcast requires that the sending address be a real mailbox on the server pointed to by your domain's MX records -- a catch-all address doesn't cut it. When in doubt, check the logs from your mail server.


The first I've heard of SPF being antiquated. I always configure a SPF record first just because it's so darned easy.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: