Sending HTML Email through mailx


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Sending HTML Email through mailx
# 1  
Old 10-04-2011
Sending HTML Email through mailx

Hi,

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

Code:
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:

Code:
<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?Smilie
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:

Code:
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.

Last edited by manubatham20; 10-04-2011 at 05:37 PM..
# 2  
Old 10-04-2011
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:
Code:
echo "Just testing" | mailx -s "Another test
X-Priority: 1 (Highest)" receiver@host.com

and see if you can set the high priority flag.
# 3  
Old 10-05-2011
Code:
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

Smilie
# 4  
Old 10-10-2011
Yeah, I finally did it through sendmail. Well thanks for your reply.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

HTML not coming while sending using email

echo "$1" > test.txt awk 'BEGIN{ FS="|" print "MIME-Version: 1.0" print "Content-Type: text/html" print "Content-Disposition: inline" print "<HTML>""<TABLE border="1"><TH>Heading1</TH><TH>Heading2</TH><TH>Heading3</TH>" } { printf "<TR>" for(i=1;i<=NF;i++) printf "<TD>%s</TD>", $i... (2 Replies)
Discussion started by: ATWC
2 Replies

2. Shell Programming and Scripting

Mailx sending attachments to personal email, but not SharePoint?

Hello! I am writing a KornShell script that (in addition to other things) sends a file from a Unix directory to a SharePoint directory. However when executing the script there is no sign of the file on the SharePoint. I have tested the script using my personal email as the destination and the... (3 Replies)
Discussion started by: mattkoz
3 Replies

3. Shell Programming and Scripting

Sending HTML Email

1) Can you please provide me with a best example of how to send an HTML email via mutt or mail or send email commands using bash shell. 2) I tried below but i am not able to get the variable values in the HTML email output. (cat <<-EOT <html> <head><title></title> </head> <body> <p>Hello,... (9 Replies)
Discussion started by: Ariean
9 Replies

4. Shell Programming and Scripting

[Solved] Sending a HTML email from cli loses formatting.

Hi, I have a .sh file, to email a report of our backups from a linux machine. It looks like this (minus a few bits): echo "HELO $host.$domain" sleep 1 echo "mail from: vdrreport@$domain" sleep 1 echo "rcpt to:$mailto" sleep 1 echo "data" sleep 1 echo "subject: $host VDR-Report... (2 Replies)
Discussion started by: cognito
2 Replies

5. UNIX for Dummies Questions & Answers

Sending html email with html attachment

Hello, I have a script which is sending an html file as an attachment. #!/usr/bin/ksh export MAILTO="user@company.com" export CONTENT="/usr/tmp/file.html" export SUBJECT="EmailSubject" ( echo "Subject: $SUBJECT" echo "MIME-Version: 1.0" echo "Content-Type: text/html" echo... (0 Replies)
Discussion started by: sreenathkg
0 Replies

6. Shell Programming and Scripting

How to embed a html file in a mail sending from Linux box with uuencode or mailx?

How to embed a html file as subject in a mail sending from Linux box with uuencode or mailx or any other way? we do not want the file as attachment, it should be embedded in the mail subject. (2 Replies)
Discussion started by: johnveslin
2 Replies

7. Shell Programming and Scripting

Referring to attached images in html email body through mailx

encoding type for images? (5 Replies)
Discussion started by: biswasbaishali
5 Replies

8. Shell Programming and Scripting

Sending email with text & attachment using mailx

I spent some time working this out, with a little help from various forums, and thought the community would like to know : Here is how you can send an email from a single Unix command line : /usr/bin/echo "Email text\nNew line\nAnother new line" >x | uuencode sourcefile.txt sourcefile.txt |... (3 Replies)
Discussion started by: haryadoon
3 Replies

9. UNIX for Advanced & Expert Users

Unable to send eMail from a UNIX-Host ( using mailx ) to a Outlook-email-addres(Win)

Hi A) I am able to send eMail using mailx from a UNIX ( solaris 8 ) host to my Outlook-email-ID : FName.Surname@Citigroup.com ( This is NOT my actual -eMail-ID). But in Outlook the "From :" eMail address is displayed as " usr1@unix-host1.unregistered.email.citicorp.com " .i.e the words... (2 Replies)
Discussion started by: Vetrivela
2 Replies

10. UNIX for Dummies Questions & Answers

sending email from mailx

hi can i know how to use mailx to send email to my lotus email account? i wan to send a file in a directory as an attachment and then email to lotus. can show me the command line to do it? thanks a lot (1 Reply)
Discussion started by: legato
1 Replies
Login or Register to Ask a Question