Jump to content

[SOLVED] super simple mail() problem ... no reason for it to be malfunctioning


doa24uk

Recommended Posts

Hi guys,

 

Here's my code. Basically this sends a simple email & a script picks it up on the other end (the script has access to the inbox) and outputs the author.

 

Obviously the author should ALWAYS be [email protected] with this script & it is .... maybe 3/10 times ... however the remaining 7 it defaults to a server allocated address - [email protected]

 

Why is it doing this? Am I trying to send too many emails in a short space of time??

 

$message = "A simple Email"
mail( "[email protected]", "Email Subject", $message, "From: [email protected]" );

that code should work


<?php
$to = "[email protected]";
$from="[email protected]";
$subject = "Hi!";
$body = "Massage";
if (mail($to, $from,  $subject, $body)) {
  echo("<p>Message successfully sent!</p>");
} else {
  echo("<p>Message delivery failed...</p>");
}
?>

hi,

 

The emails were getting through it's just the sender was appearing incorrectly.

 

It turns out that if you try and send a php mail() from a real existing address on the SAME server then it doesn't lookup the MX record correctly & so defaults to the server mail() daemon...

 

weird but I got round it by using [email protected] :)

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.