Jump to content

checking bounces from mail() function


PeggyBuckham

Recommended Posts

I have a form where the user puts in a email address. My client whats to make sure that the emails are valid emails. So after validating the format and the domain. I will send a email to the user. I want to check to see if this email bounces or not. I think that if I add

 

$headers .= "Return-Path: [email protected]\r\n";

 

to the header of the email then if it bounces  an email will be sent to [email protected]. There could end up being at least 50 bounces.  Is this the correct way to do this?? I have never used a Return-Path in the $headers before. It would be nice if I could put the email address that bounce into the database that the infor collected from the form goes.

Link to comment
https://forums.phpfreaks.com/topic/254360-checking-bounces-from-mail-function/
Share on other sites

I'm hoping someone has an answer for me becouse this is not working...yet...

All I really need is to be able to get the emails that bounce to go to a specific email address.

I would appreciate any help I can get. Thanks

Here is my code:

 

<?php

$to = $email;

$subject = "Confirmation Email";

$headers  = 'MIME-Version: 1.0' . "\r\n";

$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

$headers .= 'From:[email protected]'. "\r\n";

$headers .= 'Return-Path: [email protected]'. "\r\n";

 

$return_path = '[email protected]';

$message ='<html>

<head>

</head>

<body>

<table>

<tr>

<td>

<p>my text</p>

<img src="http://www.example.com/enews/images/photo.jpg" width="600" height="437" />

</body>

</html>';

mail($to, $subject, $message, $headers, '-f ' . $return_path);

?>

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.