Sending HTML Email through mailx

Hi,

I am trying to send html email using mailx like follow on sh shell (Bourne) on HP-UX:

mailx -s "Test HTML output in outlook
MIME-Version: 1.0
Content-Type: text/html" receiver@host.com < file.txt

Content of file.txt are as follows:

<html>
<h2>An important link to look at!</h2>
Here's an <a
href="www.google.co.in";>important
link</a>
</html>

But I am getting the plain output. Where I am doing wrong?:wall:
or can you tell me how to change "from user" while using sendmail. From and To users are on same domain.

I am sending following mail thorough sendmail:

echo "Content-Type: text/html\n<html><body><font color=red>Hello world<hr size=0></font></body></html>" | /lib/sendmail -t abc@xyz.com

But I am not getting to address while opeining the mail in outlook.

Please help!!

Thank you.

Everything you posted looks fine, I tried it out in AIX 5.3 reading the email with outlook and all worked as expected.

There must be some issue with embedding \n in the subject, it's a bit of a kludge and perhaps HPUX is stripping out everything after the \n

Why not try:

echo "Just testing" | mailx -s "Another test
X-Priority: 1 (Highest)" receiver@host.com

and see if you can set the high priority flag.

outputFile="file.txt"  
(  
echo "From: abc@exapmle.com"  
echo "To: def@example.com"  
echo "MIME-Version: 1.0"  
echo "Subject: Test"   
echo "Content-Type: text/html"   
cat $outputFile  
) | sendmail -t

:slight_smile:

Yeah, I finally did it through sendmail. Well thanks for your reply.