'mail' function no delivery, "from" address same a
Posted: Wed Sep 08, 2004 1:44 pm
Sami | Please use
mail gets delivered (different "from" and "to" addresses)
-------------------------------------
exactly as above, but
Sami | Please use
Code: Select all
andCode: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color][/size]
Hi,
When I use the php 'mail' function in our application to send mail to a "to" address that is the same as the "from" address, the mail never gets delivered. Yet, when the two addresses are different the mail goes through. It doesn't matter what I put for values of return path, sender or reply to (in case you're wondering). The 'mail' function returns successfully in both instances.
Any idea how I can send to a "to" address using the same "from" address? This is important for customer testing using our application.
Here's the two scenarios:
==========================
Does not get delivered (same "from" and "to" addresses):
-------------------------Code: Select all
<?php
$to = "andy@ridgecrestmarketing.com";
$from = "andy@ridgecrestmarketing.com";
$body = "test message";
$subject = "test subject";
$head = '';
$head .= "Content-Type: text/plain \n";
$head .= "Date: ". date('r'). " \n";
$head .= "Return-Path: $from \n";
$head .= "From: $from \n";
$head .= "Sender: $from \n";
$head .= "Reply-To: $from \n";
$head .= "X-Sender: $from \n";
$head .= "X-Priority: 3 \n";
$head .= "X-Mailer: PHP/" . phpversion();
mail($to, $subject, $body, $head);
?>mail gets delivered (different "from" and "to" addresses)
-------------------------------------
exactly as above, but
Code: Select all
$from = "[any valid email address different than the $to address above]Code: Select all
andCode: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color][/size]