0

This may sound like a bit of a stupid question, but I have an RFC 2822 standard email file:

To: Mr Person <person@example.com>
Subject: Finally Figured Out How To Send Emails!
From: Josh
Date: Tue, 20 May 2013 19:05:45
MIME-Version: 1.0
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit

<html>
    <head>
        <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
        <style>
            /* Some styles */
        </style>
    </head>
    <body>
        <!-- The text -->
    </body>
</html>

But how on Earth do I send it to someone? I want to send it from my GMail account, but I can't even figure out how to send it from my computer at the moment.

2

If your mail has got -a:

mail -a "Content-type: text/html; charset=UTF-8" -a "MIME-Version: 1.0" -a "Content-Transfer-Encoding: 7bit"-s "Finally Figured Out How To Send Emails!" person@example.com < /tmp/htmlfile.htm

Of course your mail must be configured to send emails to the outside world.

3
  • There's no way to have mail parse the email file itself? – Zaz May 21 '13 at 20:56
  • well, cat emailfile.txt | telnet mail.server.com 25 – Chris May 21 '13 at 21:02
  • I couldn't get mail or telnet to work for me, but msmtp did the trick. Thanks for the help though! – Zaz May 21 '13 at 22:30
2

To send "the mail file" using your computer MTA:

/usr/sbin/sendmail -i -t < your-mail-file-with-headers-and-body

or if you want to set envelope sender/bounces to email address:

/usr/sbin/sendmail -fYOU@EXAMPLE.NET -i -t < your-mail-file-with-headers-and-body

-i - single dot line is not the end of message
-t - get recipients list from message headers
Sendmail "look alikes" are provided by othe MTA (Postfix/Exim/...).

You may use an mail client capable to send directly via your external email account (gmail). Take a look at "Sending Email from mailx Command in Linux Using Gmail’s SMTP" - as I understand it describes heirloom mailx.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.