Jump to content

[SOLVED] send mail...


SirDuke

Recommended Posts

does anyone see what's wrong here? This little piece of code won't work. I'm calling it through a Flex application but it doesnt seem to work anway...  :-\

 

<?php
$Body = "Name: ".$_POST["fullname"]."\n";
$Body .= "Email: ".$_POST["email"]."\n";
$Body .= "Phone: ".$_POST["phone"]."\n";
$Body .= "Message: ".$_POST["text"];

$Return ="<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n";
$Return .= "<message>\r\n";

if (mail('[email protected]', $_POST["subject"], $Body) {
Return .= "<text>Message successfully sent</text>\r\n";
} else {
Return .= "<text>Message delivery failed...</text>\r\n";
}

$Return .= "</message>";
print ($Return);
?>

 

 

(also, what does that "\r" do anyway? I use it cause i saw it somewhere :P)

Link to comment
https://forums.phpfreaks.com/topic/67105-solved-send-mail/
Share on other sites

Yeah, \r is a carriage 'R'eturn (same thing [pretty much] as a 'N'ewline: \n).

In windows filesystems, a new line is \r\n

In Mac its \r

in *nix its \n

Confusing isnt it? We need some standards here...

 

The problem with you code could be

if (mail('[email protected]', $_POST["subject"], $Body) {

Return .= "<text>Message successfully sent</text>\r\n";

} else {

Return .= "<text>Message delivery failed...</text>\r\n";

}

 

what you probably mean is

if (mail('[email protected]', $_POST["subject"], $Body) {
$Return .= "<text>Message successfully sent</text>\r\n";
} else {
$Return .= "<text>Message delivery failed...</text>\r\n";
}

 

Try that, post back if it still doesn't work...

Link to comment
https://forums.phpfreaks.com/topic/67105-solved-send-mail/#findComment-336551
Share on other sites

oh that was stupid :)

 

i fixed that error but it still doesn't work. I debug from Flex to see what i get back from Apache and my message.text variable is null. I also get a "parse error" returned which makes me think this script has some kind of other error in it...

 

Any insight?

 

 

btw, what i expect to get back to Flex is:

<?xml version=\"1.0\" encoding=\"UTF-8\" ?>
<message>
<text>
Message delivery failed...
</text>
</message>

Link to comment
https://forums.phpfreaks.com/topic/67105-solved-send-mail/#findComment-337121
Share on other sites

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.