Jump to content

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


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] :)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.