How to send email from perl-script with different priorities : normalor high

S

sg

Hello,

I'm trying to send email from my perl-script with different
priorities : normal or high.
For some reasons, I'm not going to use any perl-module like
MIME::Lite.

$email = "my.email\@isp.com";
$priority = 'high';

$html = "MIME-Version: 1.0\nContent-Type: text/html\; charset=us-ascii
\n";
$html .= "Subject: FYI-- $date\n";

$html .= "Priority: $priority\n\n"; # ---> here I'm trying to change
email priority

$html .= "<CENTER><HR>";
$html .= "<H1><FONT color=\"blue\">FYI -- $date</FONT></H1>\n";
$html .= "<HR></CENTER>";

open ( MAIL, "|/usr/bin/mail $email") or die;
print MAIL $html;
close ( MAIL);

Thank you in advance,
--Simon
 
G

Gunnar Hjalmarsson

sg said:
I'm trying to send email from my perl-script with different
priorities : normal or high.

open ( MAIL, "|/usr/bin/mail $email") or die;

Try sendmail instead of mail:

open MAIL, "|/usr/sbin/sendmail -t $email" or die $!;
 
S

sg

Try sendmail instead of mail:

open MAIL, "|/usr/sbin/sendmail -t $email" or die $!;

Thank you all for support. Script works now. What is really important:

1. Format !!! $html .= "X-Priority: 1 (Highest)"."\n\n";

2. Both, /usr/bin/mail and /usr/sbin/mail -t are correctly
interpreting "HIGH" priopity parameter.

Cheers,
--Simon
 
G

Gunnar Hjalmarsson

sg said:
2. Both, /usr/bin/mail and /usr/sbin/mail -t are correctly
interpreting "HIGH" priopity parameter.

[guess you meant to say: /usr/sbin/sendmail]

Funny, I thought that Keith was right in that 'mail' doesn't allow
message headers to be set the way you described.
 
S

sg

2. Both, /usr/bin/mail and /usr/sbin/mail -t are correctly
interpreting "HIGH" priopity parameter.

[guess you meant to say: /usr/sbin/sendmail]

Funny, I thought that Keith was right in that 'mail' doesn't allow
message headers to be set the way you described.

yes, you are right - It is a typo - should be /usr/sbin/sendmail

Thank you
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,044
Messages
2,570,388
Members
47,052
Latest member
ketan

Latest Threads

Top