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.

  • 1
    That's a great idea!
    – SaintWacko
    Sep 21, 2012 at 19:44
  • You will want to keep in mind that if you're not using a SMTP server then there is a chance that you will be sending the email to their Junk/Spam mail. If you are using an SMTP server (local on network) then make sure that your ISP will allow you to host servers behind your internet connection. Many will shut you down (in the US) almost immediately.
    – kobaltz
    Sep 21, 2012 at 20:04
  • Just make sure everyone knows it's sent from a script. I did this last year, and half of the people immediately sent me a message complaining/rejoicing about who they got.
    – Dean
    Sep 21, 2012 at 21:46

2 Answers 2


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: [email protected]").

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

  • 3
    Hm, my example of a forged From: header made wonder if there really is a SecretSanta.com. And indeed there is: they provide a turnkey solution to this very problem. Sep 21, 2012 at 19:39
  • hahaha, brilliant!
    – Ramy
    Sep 21, 2012 at 19:56
  • 1
    @Ramy I just realized that somebody who knows how can look at the headers of an email and figure out the IP address of the machine running the script. Might be able to deduce your identity from that. Obviously not an issue if all recipients are technically challenged. Sep 21, 2012 at 20:16
  • oh, yeah, thanks for the insight but i'm sending an email telling everyone who their secret santa is. So...knowing where the email is irrelevant. So long as the sender of the email (me!) can't see what's in it to figure out who's getting them (me!) a gift. make sense?
    – Ramy
    Sep 22, 2012 at 1:58

Since "sent mail" is just a tag in Gmail (only a single copy of each mail exists with different tags) and you apparently cannot turn it off (as with Yahoo Mail, for example), you'd either need to delete the message if you want no record of it, or hide the "sent mail" folder.

Why not create a new Gmail account, then use it for sending but never check it? As for the actual command-line sending part, I'm sure it has already been answered here (see Ubuntu command line email tool for server for example).

  • well, yes that's a possibility, but I'd really like it if I could just have no record. If I create a new gmail account, I still have access to it. It's definitely a route I can take but it seems like I should be able to just send some text to an email address without recording what was sent.
    – Ramy
    Sep 21, 2012 at 19:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .