Send email using Perl

Ask a Question related to PERL Miscellaneous, Design and Development.

  1. #1

    Default Send email using Perl

    Hi,

    I am new to Perl and I would like to know the Perl equivalent of this
    Unix mail command:

    mailx -s "My Subject Here" [email]jdoe@mail.com[/email] < my_file_name

    Thanks in advance.

    Nick Li




    Ning li Guest

  2. Similar Questions and Discussions

    1. Send email from FMS?
      Is it possible to send an email from FMS? If not, how would I go about creating a connection from FMS to a http server running PHP? Just use...
    2. Group email doesn't send because of bad email
      Hi, say I have to email 100 people at once, but one of the email addresses is bad, meaning formatted right but does not exist anymore. Right now,...
    3. send email
      I am trying to build an intranet portal using asp. In this application I have a subsscribe button using which user can can subscribe. I wanted to to...
    4. Unable to send email via perl script
      Hi all, I have a perl script that does the sending of email. However i keep getting the same error when i run the script: Failed to connect to...
    5. how to send html email from perl
      I just had the same question, and found that the following works. If you're using the "sendmail" package (see...
  3. #2

    Default Re: Send email using Perl

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Ning li wrote:
    > Hi,
    >
    > I am new to Perl and I would like to know the Perl equivalent of this
    > Unix mail command:
    >
    > mailx -s "My Subject Here" [email]jdoe@mail.com[/email] < my_file_name
    system qq|mailx -s "My Subject Here" [email]jdoe@mail.com[/email] < my_file_name|;

    or

    `mailx -s "My Subject Here" [email]jdoe@mail.com[/email] < my_file_name`;

    or

    open (FH, "| mailx") or die . .;
    print to FH

    or the best, perl-ish way :

    perldoc Net::SMTP

    Best of luck.


    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.2.1 (GNU/Linux)
    Comment: Using GnuPG with Mozilla - [url]http://enigmail.mozdev.org[/url]

    iD8DBQE/Y9pMeS99pGMif6wRAggqAKCLN9K5lM5fzboinKZpr9WrymPeBg CgjBhT
    wcLgZCyIeLgdcTK2tCyIaF8=
    =EVL3
    -----END PGP SIGNATURE-----

    Mina Naguib Guest

  4. #3

    Default Re: Send email using Perl

    Ning li (ningli2000@worldnet.att.net) wrote on MMMDCLXVI September
    MCMXCIII in <URL:news:I6P8b.140824$3o3.10064623@bgtnsc05-news.ops.worldnet.att.net>:
    -- Hi,
    --
    -- I am new to Perl and I would like to know the Perl equivalent of this
    -- Unix mail command:
    --
    -- mailx -s "My Subject Here" [email]jdoe@mail.com[/email] < my_file_name


    system 'mailx -s "My Subject Here" [email]jdoe@mail.com[/email] < my_file_name';



    Abigail
    --
    # Perl 5.6.0 broke this.
    %0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_= shift().AC;1while+s/(\d+)((.)
    (.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi
    Abigail Guest

  5. #4

    Default Re: Send email using Perl


    "Ning li" <ningli2000@worldnet.att.net> ¼¶¼g©ó¶l¥ó
    news:I6P8b.140824$3o3.10064623@bgtnsc05-news.ops.worldnet.att.net...
    > Hi,
    >
    > I am new to Perl and I would like to know the Perl equivalent of this
    > Unix mail command:
    >
    > mailx -s "My Subject Here" [email]jdoe@mail.com[/email] < my_file_name
    in perl:
    if (`mailx -s "My Subject Here" [email]jdoe@mail.com[/email] < my_file_name`) {
    die "Mail Send Fail ";
    }
    >
    > Thanks in advance.
    >
    > Nick Li
    >
    >
    >
    >

    Bill Zhao Guest

  6. #5

    Default Re: Send email using Perl

    On Mon, 15 Sep 2003 15:51:08 +0800, Bill Zhao <bzhaoa@yahoo.com.cn> wrote:
    >
    > "Ning li" <ningli2000@worldnet.att.net> ¼¶¼g©ó¶l¥ó
    > news:I6P8b.140824$3o3.10064623@bgtnsc05-news.ops.worldnet.att.net...
    >> Hi,
    >>
    >> I am new to Perl and I would like to know the Perl equivalent of this
    >> Unix mail command:
    >>
    >> mailx -s "My Subject Here" [email]jdoe@mail.com[/email] < my_file_name
    > in perl:
    > if (`mailx -s "My Subject Here" [email]jdoe@mail.com[/email] < my_file_name`) {
    > die "Mail Send Fail ";
    > }
    Did you even think about that for a second? Did you really want to
    interpolate the array @mail into that command?

    Why does mailx indicate failure by outputting to stdout? That seems like
    a remarkably stupid way of indicating failure.

    Of course it probably doesn't. It's far more likely you just don't know
    how to execute a command correctly in perl...

    --
    Sam Holden

    Sam Holden Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139