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

Discussion in 'Perl Misc' started by sg, Jan 10, 2008.

  1. sg

    sg Guest

    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
     
    sg, Jan 10, 2008
    #1
    1. Advertising

  2. Re: How to send email from perl-script with different priorities

    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
     
    Gunnar Hjalmarsson, Jan 10, 2008
    #2
    1. Advertising

  3. sg

    sg Guest

    Re: How to send email from perl-script with different priorities :normal or high

    On Jan 10, 12:54 pm, Gunnar Hjalmarsson <> 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
     
    sg, Jan 10, 2008
    #3
  4. Re: How to send email from perl-script with different priorities

    sg wrote:
    > On Jan 10, 12:54 pm, Gunnar Hjalmarsson <> 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
     
    Gunnar Hjalmarsson, Jan 10, 2008
    #4
  5. sg

    sg Guest

    Re: How to send email from perl-script with different priorities :normal or high

    On Jan 10, 3:27 pm, Gunnar Hjalmarsson <> wrote:
    > sg wrote:
    > > On Jan 10, 12:54 pm, Gunnar Hjalmarsson <> 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
     
    sg, Jan 11, 2008
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sebastian Millies

    SwingWorker and inherited thread priorities

    Sebastian Millies, Sep 12, 2005, in forum: Java
    Replies:
    5
    Views:
    2,347
    Thomas Hawtin
    Sep 12, 2005
  2. Soren Kuula
    Replies:
    2
    Views:
    573
    Malcolm Dew-Jones
    Apr 13, 2005
  3. Replies:
    4
    Views:
    499
  4. Replies:
    2
    Views:
    126
    Eric Pozharski
    Mar 3, 2009
  5. heycooldude
    Replies:
    0
    Views:
    228
    heycooldude
    Mar 26, 2014
Loading...

Share This Page