|
-
Dec 4th, 2002, 07:48 PM
#1
Thread Starter
Frenzied Member
If Mail Sent Echo ?? if not echo --.. Should be basic (i hope?) *rslvd*
Hey ya,
Am i right or wrong in thinking this should work?
I want to tell the user that an email has been sent to their friend, IF it sends sucessfully, & if not, tell them the email failed..
Is there a code error or?
PHP Code:
if(mail($to_name."<".$to_email.">", $subject, $message, $headers)){
echo "An email has been sent to ".$to_name." <a href=\"mailto:".$to_email."\">".$to_email."</a> telling him/her about ".$sitename."<BR>\n";
echo "Thank you for suggesting our website to your friend!<BR>\n<BR>\n";
echo "<a href=\"".$baseurl."\">Return To The Main Page</a>\n";
}else{
echo "Failed to send the email to <a href=\"mailto:".$to_email."\">".$to_email."</a>\n";
}
Last edited by wpearsall; Dec 5th, 2002 at 06:31 AM.
Wayne
-
Dec 4th, 2002, 11:32 PM
#2
Stuck in the 80s
It should work, according to the manual:
Code:
mail() returns TRUE if the mail was successfully accepted for delivery, FALSE otherwise.
Try this to supress the errors and report on your own:
Code:
if(@mail(...)){
echo "success!";
}else{
echo "Failed!";
}
What happens when you try that? Maybe you need to do:
Code:
if((@mail(...)) === true){
echo "success!";
}else{
echo "Failed!";
}
I can't see why though.
Also note that the function executing successfully does not ensure that the mail will make it. Wrong addresses, downed servers, etc could cause the mail to not make it.
-
Dec 5th, 2002, 06:33 AM
#3
Thread Starter
Frenzied Member
oh, i meant to change the topic title in the nite,
I solved it
PHP Code:
if(mail($to_name."<".$to_email.">",
has to be:
PHP Code:
if(mail($to_email",
Woulda been nice to include the name in the headers, but No biggy 
Tnx anyhow
-
Dec 10th, 2002, 03:01 PM
#4
Frenzied Member
then send it in the headers. the $to is not the header. I believe it is
$header = "To: name_here; FROM:: from_here";
I am not sure if that works but it would look something like that.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|