-2

From linux, I send this file to an outlook account...

<html>
<h2>HELLO</h2>
</html>

It appears just as you see, plain text.
How can I get this to display on Outlook as it appears when I run it through firefox on liunux ?

In linux, I sent it as plain test using a system call in a perl script....

mail -s 'the title' 'recipient' < the_file.html. 

'which mail' eventually ends up being mailx

The thinking is that outlook would recognize the "html" (between the < and > which won't display here) as line 1 and do the right thing.

daveg
  • 1,051
  • 11
  • 24
  • please let us know how you sent that mail. most smtp client implementations provide a functionality to set a flag saying an email is an html-mail or just plain text. – Michriko Feb 18 '20 at 21:03
  • I sent it as plain test using a system call in a perl script.... mail -s 'the title' 'recipient' < the_file.html. 'which mail' eventually ends up being mailx – daveg Feb 18 '20 at 21:08
  • so you do not want to send a mail, you want to open a html file with a mail client? – Michriko Feb 18 '20 at 21:12
  • I definitely want to send email from the perl script. The info is in a file. I picked html because some of the text needs to be colored. But I'm not married to html. It there's some other way I can mail a flat file to Outlook and have it show certain words as red/green/blue (as I choose), that would be great. – daveg Feb 18 '20 at 21:18
  • The filename extension is ".html", thinking/hoping Outlook would recognize that. – daveg Feb 18 '20 at 21:19

2 Answers2

0

You need to set the correct ContentType in the header. e.g.: Content-Type: text/html; charset=UTF-8

Here is an old example in Perl that might help you: How can I send an HTML email with Perl?

Michriko
  • 337
  • 1
  • 11
0

As it turns out, we also had "mutt" installed and I was able to use that. E.g.

my $cmd = "mutt -e 'set content_type=text/html' -s '${title}' '${to_list}' < ${email_file}"
my $stat = system($cmd);
daveg
  • 1,051
  • 11
  • 24