Jump to content

Recommended Posts

Posted

I recently modified a (php) calendar script to notify admin (me) whenever a registered user posts an event. I simply added:

 

><?php

 mail( "calendar@mysite.org", "Event $month / $day / $year",
	$text, $title );
?>

 

and I get the information. Problem is it comes from Nobody@mytchserver.here. Ok, Nobody owns the script right?

 

So how can I get the email to be sent from the site? Spam filters go crazy with mail from Nobody. Probably an easy fix but I'm just not seeing it. :lol:

 

Thanks for any input, it's always appreciated.

 

Ty

Posted

Example 3 on the link Jeren gave should also help

><?php
 mail( "calendar@mysite.org", "Event $month / $day / $year", $text, $title, "-fmyscript@mysite.com");
?>

Posted

Thanks guys, much appreciated. #3 gave the right 'from' address but kept sending as Nobody <calendar@mysite.org> so I ended up with:

 

><?php
$to	  = 'calendar@mysite.org';
$subject = "Event Added $month / $day / $year";
$message = "$title\n\n $text";
$headers = 'From: calendar@mysite.org' . "\r\n" .
'Reply-To: calendar@mysite.org' . "\r\n" .
'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>

 

which sends to the right address with no name attached, which is fine!

 

Thanks again. :lol:

Join the conversation

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

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

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