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 me@mysite.com with this script & it is .... maybe 3/10 times ... however the remaining 7 it defaults to a server allocated address - mysite@box975.myhost.com

 

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

 

$message = "A simple Email"
mail( "yourname@example.com", "Email Subject", $message, "From: me@mysite.com" );

Link to comment
Share on other sites

that code should work


<?php
$to = "me@mysite.com";
$from="me@mine.com";
$subject = "Hi!";
$body = "Massage";
if (mail($to, $from,  $subject, $body)) {
  echo("<p>Message successfully sent!</p>");
} else {
  echo("<p>Message delivery failed...</p>");
}
?>

Link to comment
Share on other sites

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 547849875498754389@yahoo.com :)

Link to comment
Share on other sites

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.