SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2005
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question mail using perl problem

    Hey i have this script and it doesn't work i am using yahoo webhosting and you can try it here:
    http://www.munnaz.com/footytipping/members/test.cgi
    Any ideas why it doesn't work??
    ps. don't know much at all about PERL but know PHP

    Thanks in advance. Munnaz

    Code:
    #!/usr/bin/perl
    print "Content-type: text/html\n\n"; 
    
    $title='mail test';
    $to='munnaz_2003@hotmail.com';
    $from= 'admin@munnaz.com';
    $subject='Using Sendmail';
    
    open(MAIL, "|/usr/sbin/sendmail -t");
    
    ## Mail Header
    print MAIL "To: $to\n";
    print MAIL "From: $from\n";
    print MAIL "Subject: $subject\n\n";
    ## Mail Body
    print MAIL "This is a test message from Yahoo! \n";
    
    close(MAIL);
    
    print "<html><head><title>$title</title></head>\n<body>\n\n";
    
    ## START HTML content
    print "<h1>$title</h1>\n";
    print "<p>A message has been sent from $from to $to";
    ## END HTML CONTENT
    print "\n\n</body></html>";

  2. #2
    SitePoint Wizard bronze trophy KevinR's Avatar
    Join Date
    Nov 2004
    Location
    Moon Base Alpha
    Posts
    1,053
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    looks like it should work if the path to sendmail is correct. Try this:

    Code:
    open(MAIL, "|/usr/sbin/sendmail -t") or die "can't open sendmail: $!";

  3. #3
    SitePoint Enthusiast
    Join Date
    Apr 2005
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    no still not working if you visit it here:
    http://www.munnaz.com/footytipping/members/test.cgi
    it says no errors and says it works but it doesn't.

    Could there be a problem with yahoo etc. or is there any other simple way to sen a email from a form
    thanks
    munnaz

  4. #4
    SitePoint Wizard bronze trophy KevinR's Avatar
    Join Date
    Nov 2004
    Location
    Moon Base Alpha
    Posts
    1,053
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by munnaz_2003 View Post
    Could there be a problem with yahoo etc. or is there any other simple way to sen a email from a form
    thanks
    munnaz
    It could be a problem with yahoo. Have you checked their FAQs or help files to see how to use sendmail on their servers? That is pretty much the simplest way to send an email. You could look into using the MIME::Lite module, but you have to check if it's installed on the yahoo servers.

    http://search.cpan.org/~yves/MIME-Li...b/MIME/Lite.pm

  5. #5
    SitePoint Enthusiast
    Join Date
    Sep 2006
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A lot of email providers don't accept emails if they don't have a "Reply-To:" Specified. Try adding this to your code before you open MAIL:

    Code:
    $replyto = 'admin@munnaz.com';
    And add this to the email header just after you define who it's from:

    Code:
    print MAIL "Reply-To: $replyto\n";
    That should make it work.
    Arcade Trade Script
    An arcade script with a powerful traffic trading system built in.


Bookmarks

Posting Permissions

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