Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > How to send email from perl-script with different priorities : normalor high

Reply
Thread Tools

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

 
 
sg
Guest
Posts: n/a
 
      01-10-2008
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
 
Reply With Quote
 
 
 
 
Gunnar Hjalmarsson
Guest
Posts: n/a
 
      01-10-2008
sg wrote:
> I'm trying to send email from my perl-script with different
> priorities : normal or high.


<snip>

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


Try sendmail instead of mail:

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

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
 
Reply With Quote
 
 
 
 
sg
Guest
Posts: n/a
 
      01-10-2008
On Jan 10, 12:54*pm, Gunnar Hjalmarsson <(E-Mail Removed)> wrote:
> sg wrote:
> > I'm trying to send email from my perl-script with different
> > priorities : normal or high.

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

>
> Try sendmail instead of mail:
>
> open MAIL, "|/usr/sbin/sendmail -t $email" or die $!;
>
> --
> Gunnar Hjalmarsson
> Email:http://www.gunnar.cc/cgi-bin/contact.pl


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
 
Reply With Quote
 
Gunnar Hjalmarsson
Guest
Posts: n/a
 
      01-10-2008
sg wrote:
> On Jan 10, 12:54 pm, Gunnar Hjalmarsson <(E-Mail Removed)> wrote:
>> sg wrote:
>>>
>>> open ( MAIL, "|/usr/bin/mail $email") or die;

>>
>> Try sendmail instead of mail:
>>
>> open MAIL, "|/usr/sbin/sendmail -t $email" or die $!;

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

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
 
Reply With Quote
 
sg
Guest
Posts: n/a
 
      01-11-2008
On Jan 10, 3:27*pm, Gunnar Hjalmarsson <(E-Mail Removed)> wrote:
> sg wrote:
> > On Jan 10, 12:54 pm, Gunnar Hjalmarsson <(E-Mail Removed)> wrote:
> >> sg wrote:

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

>
> >> Try sendmail instead of mail:

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

>
> > 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.
>
> --
> Gunnar Hjalmarsson
> Email:http://www.gunnar.cc/cgi-bin/contact.pl


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

Thank you
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Why the same script have different behavior when executed in Normalor Debug mode? djslls@sina.com Perl Misc 2 03-03-2009 10:10 PM
Sorting results by 2 different priorities jose.jeria@gmail.com XML 4 07-14-2005 12:50 PM
Network connection priorities =?Utf-8?B?SnVhbiBBbnRvbmlv?= Wireless Networking 2 07-04-2005 11:30 PM
Can you configure different priorities with syslog Phil Cisco 1 05-22-2004 06:00 AM



Advertisments