Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

net::smtp

  • 07-06-2006 7:37pm
    #1
    Closed Accounts Posts: 839 ✭✭✭


    i'm having trouble using net::smtp module for perl i can't find any good examples what i wanna do is,

    e-mail jim@john.com cc it to paul@john.com (has to be cc cause server won't allow more that 1 receiptent) subject: Test Message: Testing 1,2


Comments

  • Registered Users, Registered Users 2 Posts: 6,570 ✭✭✭daymobrew


    The module's documentation has multiple examples.
    I suggest turning debugging on in the 'new' call [Net::SMTP->new( 'mailhost', Debug=>1) ]
    It will display the mail server's responses which will give you an idea what is wrong.

    Here is the simple example from the docs. This should be a good starting point.
    #!/usr/local/bin/perl -w
    
    use Net::SMTP;
    
    $smtp = Net::SMTP->new('mailhost', Debug=>1);
    
    $smtp->mail($ENV{USER});
    $smtp->to('postmaster');
    
    $smtp->data();
    $smtp->datasend("To: jim\@john.com\n");
    $smtp->datasend("\n");
    $smtp->datasend("A simple test message\n");
    $smtp->dataend();
    
    $smtp->quit;
    
    Post your code if you still have problems.


  • Closed Accounts Posts: 839 ✭✭✭zap


    I have seen that example what I don't get is how to specify the subject and a cc


  • Closed Accounts Posts: 8,866 ✭✭✭Adam


    I suggest you have a quick look over that documentation again because I haven't much of an idea about this but from the link:
    recipient ( ADDRESS [, ADDRESS, [...]] [, OPTIONS ] )

    Notify the server that the current message should be sent to all of the addresses given. Each address is sent as a separate command to the server. Should the sending of any address result in a failure then the process is aborted and a false value is returned. It is up to the user to call reset if they so desire.

    EDIT: Alternatively try this - http://quark.humbug.org.au/publications/perl/perlsmtpintro.html

    I've never used Perl and even I could implement that without a problem, its all given too you...


Advertisement