Can't send html email using exim

1k views Asked by At

I'm trying to send html mail using smarthost with the following command:

cat test_mail.txt | mail -a "MIME-Version: 1.0" -a "Content-Type: text/html" -s "title" [email protected]

I have also tried using this:

mail  -a "Content-type: text/html;" -s 'title' [email protected]  < test_mail.txt

But it is not possible because I get this error:

MIME-Version: 1.0: No such file or directory

I'm using exim:

dpkg -S `which sendmail`
exim4-daemon-light: /usr/sbin/sendmail

My system is Ubuntu 14.04.2 LTS.

1

There are 1 answers

0
user3461823 On

I found workaround. I installed postfix, so mail configuration is like that:

dpkg -S `which sendmail`
postfix: /usr/sbin/sendmail

Then you can send an email using following command:

cat mailheader mailbody | sendmail -t

where mailheader it is file containing:

To: [email protected]
Subject: Example Subject
Content-Type: text/html; charset=UTF-8

and mailbody it is file with your message.