sendmail returnpath
Results 1 to 4 of 4

Thread: sendmail returnpath

  1. #1
    Member
    Join Date
    Feb 2008
    Posts
    95

    sendmail returnpath

    My php email script is working. However, I would like to capture any bounce-backs. My code looks like this:

    PHP Code:
            $to      $data[2];
            
    $subject "something";
            
    $message "Dear $data[1],\n
                        etc. etc. etc"
    ;
            
    $headers 'From: jr@ahlmann.us' "\r\n" .
                    
    'X-Mailer: PHP/' phpversion();
            
    $mailsend mail($to$subject$message$headers);
            if (!
    $mailsend) {
                    echo 
    "<h1>mail NOT sent</h1>";
               }; 
    What does the returnpath look like and where does it go? If there is such a thing.

    Thanks for your help.

  2. #2
    Settled 4 red convertible dalecosp's Avatar
    Join Date
    Jul 2002
    Location
    Accelerating Windows at 9.81 m/s....
    Posts
    7,697
    Pretty sure it's Return-Path, e.g.:
    PHP Code:
    $headers 'From: jr@ahlmann.us' "\r\n" 
            
    'Return-Path: thisbounced@example.com' "\r\n" .
            
    'Reply-To: someoneelse@example.com' "\r\n" .
                    
    'X-Mailer: PHP/' phpversion(); 
    Be aware that some M.T.A.'s will totally ignore Return-PATH, though. There's a lot of discussion about this out there.
    /!!\ mysql_ is deprecated --- don't use it! Tell your hosting company you will switch if they don't upgrade! /!!!\ ereg() is deprecated --- don't use it!

    dalecosp "God doesn't play dice." --- Einstein "Perl is hardly a paragon of beautiful syntax." --- Weedpacket

    Getting Help at All --- Collected Solutions to Common Problems --- Debugging 101 --- Unanswered Posts --- OMBE: Office Machines, Business Equipment

  3. #3
    Senior Member
    Join Date
    Apr 2003
    Location
    Silver Lake
    Posts
    4,845
    Mail servers might not even bother to send bounce messages. There are tons of them out there with bazillions of different configurations.

    I would strongly recommend that you filter/validate your $data array or your script might be vulnerable to abuse, in which case you'll eventually have problems sending mail.

    You might want to use filter_var on $data[2], for instance.
    IMPORTANT: STOP using the mysql extension. Use mysqli or pdo instead.
    World War One happened 100 years ago. Visit Old Grey Horror for the agony and irony.

  4. #4
    Member
    Join Date
    Feb 2008
    Posts
    95
    Thanks for all your help. I appreciate it.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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