sending email thru perl script

Discussion in 'Perl Misc' started by dawnofdigital@gmail.com, May 3, 2006.

  1. Guest

    Hi, I'm new to cgi/perl and I'm wondering how to send an email through
    a perl program to a future user on my site. I've been experimenting and
    so far I've gotten the following, but it doesnt seem to be working. Can
    anyone point me in the right direction with this little script?

    #!/usr/local/bin/perl -w
    use CGI;
    $cgi = new CGI();
    print $cgi->header();
    use Net::SMTP;
    my $adress = "dawnofdi\@dawnofdigital.net";
    my $smtp = Net::SMTP->new('localhost');
    $smtp->mail("dawnofdi\@dawnofdigital.net");
    $smtp->to("dawnofdigital\@gmail.com");
    $smtp->data();
    $smtp->datasend("From: dawnofdi\@dawnofdigital.net\n");
    $smtp->datasend("To: dawnofdigital\@gmail.com\n");
    $smtp->datasend("Subject: Email Script Test\n");
    $smtp->datasend("\n");
    $smtp->datasend("If you are reading this, then emailsend.cgi works!");
    $smtp->dataend();
    $smtp->quit();
    print "successfully sent to dawnofdigital\@gmail.com";
     
    , May 3, 2006
    #1
    1. Advertising

  2. Keith Keller Guest

    On 2006-05-03, <> wrote:
    > Hi, I'm new to cgi/perl and I'm wondering how to send an email through
    > a perl program to a future user on my site. I've been experimenting and
    > so far I've gotten the following, but it doesnt seem to be working.


    Define "it doesn't seem to be working"! Be specific. What do
    you want to see (that might seem obvious, but make it explicit),
    what do you do to run the script, and what happens?

    > #!/usr/local/bin/perl -w


    use strict;
    use warnings;

    > use CGI;
    > $cgi = new CGI();
    > print $cgi->header();
    > use Net::SMTP;
    > my $adress = "dawnofdi\@dawnofdigital.net";


    You define this variable, but don't use it.

    > my $smtp = Net::SMTP->new('localhost');


    You should check the return value, and emit a message if new
    doesn't connect.

    As for the rest, without you describing how your script is failing,
    anyone would be hard-pressed to make any recommendations.

    --keith

    --
    -francisco.ca.us
    (try just my userid to email me)
    AOLSFAQ=http://wombat.san-francisco.ca.us/cgi-bin/fom
    see X- headers for PGP signature information
     
    Keith Keller, May 3, 2006
    #2
    1. Advertising

  3. Guest

    wrote:
    >> [a question]


    This question has been multi-posted (to PB). Multiposting is the usenet
    mortal sin.

    I presume the OP is not a rude person and doesn't understand why
    multiposting is so rude. The OP may therefore wish to review the
    posting guilelines for this newsgroup (http://tinyurl.com/pjzmm) where
    this is explained.

    The OP should realize that repeated infractions (especially
    multiposting) will get him/her killfiled, especially in this particular
    newsgroup.

    I suggest this thread be burned.

    --
    http://DavidFilmer.com
     
    , May 3, 2006
    #3
  4. Guest

    wrote:
    > multiposting is so rude. The OP may therefore wish to review the
    > posting guilelines for this newsgroup (http://tinyurl.com/pjzmm) where
    > this is explained.


    You know what - I don't actually think this IS explained in the CLPMisc
    guidelines. So permit me to add my own explanation:

    WHAT IS CROSS-POSTING?
    Cross-posting is when the same message is posted to multiple
    newsgroups, but it is possible for group participants to discern (by
    the message header) that the message has been cross-posted. This is
    usually considered poor usenet ettiquete. Also, some usenet clients
    (esp. GoogleGroups) "reply to all" by default, so if a responder does
    not notice that the message is cross-posted, s/he may send a response
    to multiple groups when this was not the intent.

    WHAT IS MULTI-POSTING?
    Multi-posting is when the same message is posted to multiple
    newsgroups, but this fact cannot be determined by the message headers.
    Therefore, someone reading the thread has no way to know that the same
    message is posted elsewhere (unless s/he happens to visit the other
    newsgroup).

    WHY IS MULTI-POSTING SO RUDE?
    Because when you ask a question in multiple groups (without telling
    anybody), it is possible and likely that kind and helpful people will
    take the time and effort to respond to the question even though it may
    have ALREADY BEEN ANSWERED elsewhere. This wastes the time of the kind
    responder. It is rude to waste the time of folks who only want to be
    helpful.

    WHEN/HOW IS MULTIPOSTING ACCEPTABLE?
    If you wish to later post the same question in another newsgroup
    (for whatever reason), you should make it known in your new post where
    the question is already posted (and maybe furnish a link), and you
    should respond to your original message with the information about
    where the question is now also posted (and maybe furnish a link). This
    lets folks in both newsgroups know that the question is posted
    elsewhere, and gives them the opportunity to investigate other
    responses before taking the time and effort to respond themselves.

    When I encounter a "stealth" multipost (usually between CLPMisc and PB)
    I always alert both communities and suggest the thread be burned.

    --
    http://DavidFilmer.com
     
    , May 3, 2006
    #4
  5. Dr.Ruud Guest

    [OT] guidelines (was: Re: sending email thru perl script)

    schreef:

    > WHAT IS MULTI-POSTING?
    > Multi-posting is when the same message is posted to multiple
    > newsgroups, but this fact cannot be determined by the message headers.


    With multi-posting it is technically not the same message, but a new
    independent message per group. Each message has its own Message-ID.

    --
    Affijn, Ruud

    "Gewoon is een tijger."
     
    Dr.Ruud, May 3, 2006
    #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. THTB
    Replies:
    0
    Views:
    215
  2. Amit Shinde

    Sending Email thru ASP

    Amit Shinde, Feb 28, 2004, in forum: ASP General
    Replies:
    2
    Views:
    111
    Bullschmidt
    Mar 2, 2004
  3. dave

    sending image thru email + CDO

    dave, Jun 8, 2004, in forum: ASP General
    Replies:
    2
    Views:
    190
    Aaron [SQL Server MVP]
    Jun 8, 2004
  4. .Net Sports

    Membership signup script thru email

    .Net Sports, Oct 3, 2006, in forum: ASP General
    Replies:
    2
    Views:
    163
    http://support.cjwsoft.com/code/code_info.asp?TID=
    Oct 4, 2006
  5. Max Williams
    Replies:
    3
    Views:
    189
    Robert Klemme
    Jan 6, 2009
Loading...

Share This Page