Unable to send ay mails

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • roopamt
    New Member
    • Nov 2012
    • 1

    Unable to send ay mails

    Hi All,

    I am trying to send the mail using the following code, it won't give any errors but again it won't send any mails. Please help me out to solve the issue,

    Code:
    #!/usr/bin/perl
    
    my $to='xxx@systems.com';
    my $from='yyy@systems.com';
    my $subject='Test Mail';
    
    # send email using UNIX/Linux sendmail
    open(MAIL, "|/usr/sbin/sendmail -t");
    my $out = "Have sent the mail using perl scripting";
    
    
    ## Mail Header
    print MAIL "To: $to\n";
    print MAIL "From: $from\n";
    print MAIL "Subject: $subject\n";
    
    ## Mail Body
    print MAIL $out;
    
    close(MAIL);
    Last edited by Meetee; Nov 5 '12, 08:14 AM. Reason: code tags added
  • zmbd
    Recognized Expert Moderator Expert
    • Mar 2012
    • 5501

    #2
    From another tutorial, the only difference I can see that could be causing you issues is in Line 15: add an additional "\n" and retry.

    Comment

    Working...