SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict
    Join Date
    Mar 2003
    Location
    In a house in the USA
    Posts
    293
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Alternative to Mail() ?

    Hello, I have a script that I am trying to fix for a client and on his server and the mail() function does not send the emails out. Is there an alternative to use to send basic emails? Thanks!
    Daniel
    http://www.wlscripting.com - PHP Tutorials and code snippets
    Notepad++ Function List plugin tip - for PHP developers

  2. #2
    SitePoint Zealot jadmadi's Avatar
    Join Date
    Sep 2003
    Location
    Jordan
    Posts
    154
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    cgi form mailer?
    frontpage extention ?
    PHP SMTP rely?

  3. #3
    La la la la la bronze trophy lieut_data's Avatar
    Join Date
    Jun 2003
    Location
    Waterloo, ON
    Posts
    1,517
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    SocketMail (simple function I found to get around some header issues):

    PHP Code:
    <?php
    function socket_mail($from_name$from_address$to_name$to_address$subject$headers) {
      
    ini_set(sendmail_from$from_address);

      
    $connect fsockopen (ini_get("SMTP"), ini_get("smtp_port"), $errno$errstr30) or die("Could not talk to the sendmail server!"); 
      
    $rcv .= fgets($connect1024); 

      
    fputs($connect"HELO {$_SERVER['SERVER_NAME']}\r\n");
      
    $rcv .= fgets($connect1024); 


      
    fputs($connect"MAIL FROM:$from_address\r\n"); 
        
    $rcv .= fgets($connect1024); 

      
    fputs($connect"RCPT TO:$to_address\r\n"); 
        
    $rcv .= fgets($connect1024); 

      
    fputs($connect"DATA\r\n"); 
        
    $rcv .= fgets($connect1024); 

        
    fputs($connect"Subject: $subject\r\n"); 
        
    fputs($connect"From: $from_name <$from_address>\r\n"); 
        
    fputs($connect"To: $to_name  <$to_address>\r\n"); 
        
    fputs($connect"X-Sender: <$from_address>\r\n"); 
        
    fputs($connect"Return-Path: <$from_address>\r\n"); 
        
    fputs($connect"Errors-To: <$from_address>\r\n"); 
        
    fputs($connect"X-Mailer: PHP\r\n"); 
        
    fputs($connect"X-Priority: 3\r\n"); 

        
    fputs($connect$headers); 

        
    fputs($connect".\r\n"); 
          
    $rcv .= fgets($connect1024); 
        
    fputs($connect"RSET\r\n"); 
          
    $rcv .= fgets($connect1024); 

      
    fputs ($connect"QUIT\r\n"); 
        
    $rcv .= fgets ($connect1024); 
      
    fclose($connect);
      
    ini_restore(sendmail_from);
      

    ?>
    This, mind you, requires that you build the headers yourself (i.e. Content-Type, etc...) [Which is what I wanted to do at the time]

    If you need a more in-depth solution try phpMailer
    My name is Steve, and I'm a super-villian.

  4. #4
    SitePoint Addict
    Join Date
    Mar 2003
    Location
    In a house in the USA
    Posts
    293
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello, I just installed it on one other server of his and when you put in a hotmail account in the to section and it will send the mail. But when you change the email to his email or my email it will not send the email. I have been using the following code:
    PHP Code:
     mail($order_email$subject$msgtxt"To: $order_email <$order_email>\n" "From: $email <$email>"); 
    I have used this code on many sites and have not had any problems. Any other ideas?
    Thanks lieut_data for the code. I will check it out.
    Daniel
    http://www.wlscripting.com - PHP Tutorials and code snippets
    Notepad++ Function List plugin tip - for PHP developers

  5. #5
    Freelance Web Guy freekrai's Avatar
    Join Date
    May 2003
    Location
    Penticton,BC
    Posts
    400
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by WLHosting
    Hello, I just installed it on one other server of his and when you put in a hotmail account in the to section and it will send the mail. But when you change the email to his email or my email it will not send the email. I have been using the following code:
    PHP Code:
     mail($order_email$subject$msgtxt"To: $order_email <$order_email>\n" "From: $email <$email>" ); 
    I have used this code on many sites and have not had any problems. Any other ideas?
    Thanks lieut_data for the code. I will check it out.
    This sounds like a DNS issue from that server. I've run into similiar before and it was a headache that suddenly went away.
    If you can, try pinging your email server from his server and see if you get any response.
    Roger Stringer
    DBStract - Build a database - Gather data - View it from every angle
    Other Sites: [ 1 ][ 2 ][ 3 ][ 4 ][ 5 ]



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
  •