Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-13-2009, 03:04 PM   PM User | #1
alcool9999
New Coder

 
Join Date: Aug 2009
Posts: 84
Thanks: 10
Thanked 0 Times in 0 Posts
alcool9999 is an unknown quantity at this point
Email script

Hi i have this php mail script and it says message sent successfuly but i never recieve the message.
any help apreciated.

i know my email address needs to go where "you@someone.com" is so thats not the problem.
code:

<?php
$to = "you@someone.com";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
if (mail($to, $subject, $body)) {
echo("<p>Message successfully sent!</p>");
} else {
echo("<p>Message delivery failed...</p>");
}
?>
alcool9999 is offline   Reply With Quote
Old 09-13-2009, 03:53 PM   PM User | #2
macpeace
New Coder

 
Join Date: Sep 2009
Location: Portugal/Porto
Posts: 15
Thanks: 2
Thanked 0 Times in 0 Posts
macpeace is an unknown quantity at this point
Hi;

I use this and it works fine....

Code:
<?
$recipient = "yourmail@else.com";
$subject = "Hi";

$mssg = "
$mssg .= "the message\n";
$mssg .= "";

mail($recipient, $subject, $mssg, $mailheaders) or die ("Could't send message");
?>

<?
echo "Sucess";
?>
macpeace is offline   Reply With Quote
Old 09-13-2009, 05:46 PM   PM User | #3
SKDevelopment
Regular Coder

 
Join Date: Mar 2006
Posts: 238
Thanks: 3
Thanked 37 Times in 37 Posts
SKDevelopment has a little shameless behaviour in the past
Quote:
Originally Posted by alcool9999 View Post
<?php
$to = "you@someone.com";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
if (mail($to, $subject, $body)) {
echo("<p>Message successfully sent!</p>");
} else {
echo("<p>Message delivery failed...</p>");
}
?>
This your script worked form me too. I have sent an e-mail to my gmail e-mail address. I have received it but found it in the "Spam" folder. I think probably because "From" and "Reply-To" headers have been absent. Or maybe the message has been too short.

Anyway, if you have a spam-filter, I would check if it did not cut the message ... It could be quite probable that the message is sent but you do not see it due to a spam filter... At least the script worked for me in this way.
__________________
PHP Programmer
SKDevelopment is offline   Reply With Quote
Old 09-13-2009, 05:57 PM   PM User | #4
clunk.werclick
New Coder

 
Join Date: Jul 2009
Posts: 91
Thanks: 5
Thanked 6 Times in 6 Posts
clunk.werclick is an unknown quantity at this point
If you suspect it may be being blocked by anti-spam feel free to fire it to me at:

cf13092009@wibblywobblyteapot.co.uk

Make a note of the time when you do it, and I'll tell you if it's getting killed by something like an RBL or Spamassassin based device.

I love spam myself, I just don't get it any more :-)
clunk.werclick is offline   Reply With Quote
Old 09-17-2009, 07:59 AM   PM User | #5
jegan2k9
New to the CF scene

 
Join Date: Sep 2009
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
jegan2k9 can only hope to improve
Hi alcool9999,

This may script may help you,
Use this and try ,

$mail_to="to@example.com";
$mail_from = "from@example.com";
$mail_sub = "sample"; // The Subject of the email
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "From: $mail_from";
$mail_mesg ="some text ";
mail($mail_to,$mail_sub,$mail_mesg,$headers);

You have not mentioned the header in the parameters.

Thanks

Last edited by JohnDubya; 09-22-2009 at 04:21 PM.. Reason: Removed advertisement links
jegan2k9 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:17 AM.


Advertisement
Log in to turn off these ads.