Ubuntu – Sending mail from the command line


Ok, I've looked far and wide for something to take care of this little email project I have.

First, some background:
My family has a secret santa every year and I've offered to write a script to randomize who gets gifts for whom. What I'd like to do is send an email letting people know who they'll be getting a gift for but I DON'T want to send the email through my gmail account since I'll be involved in the Secret Santa.

The question:
how can I send an email from the command line/a script without having that email stored in my "sent items" in my gmail account (or any other mail account). I think i'd have set up my own smtp server, but I'm really pretty clueless.

Best Answer

You do need a special SMTP server, but you don't need to set it up yourself. As somebody has already suggested, you can create a bogus Gmail account and use the SMTP for that. Or, for really anonymity, you can use a SMTP provider; this will allow you to forge your return address (the same way spammers do) for an extra layer of anonymity and customization ("From: YourFriend@SecretSanta.com").

Here's help on configuring sendmail to use SMTP, useful when specifying headers directly instead of relying on your mail client.