|
User #240543 937 posts
Whirlpool Enthusiast
|
I have made a script to send emails in PHP: <?php $body = $_GET["email"]; echo("<br/><br/>Message successfully sent!</p>"); } else { echo("<br/><br/>Message delivery failed...</p>"); } ?> But when i load the page it says: Message successfully sent!"); } else { echo(" Message delivery failed... where am i going wrong? |
reference: whrl.pl/RccrXR
posted 2010-Mar-11, 7pm AEST
|
|
User #44690 20646 posts
Whirlpool Forums Addict
|
Check that your double-quotes are "real" double-quotes and not “curly” quotes or some other vaguely quote-like symbol. Edit: That won't be the problem, but it might keep you occupied until we can think of something else. |
reference: whrl.pl/Rccr2b
posted 2010-Mar-11, 7pm AEST
edited 2010-Mar-11, 7pm AEST
|
|
User #166340 934 posts
Whirlpool Enthusiast
|
I just had a go at it, and it works fine for me (copied and pasted). You could try what Foonly said, but imho that would be likely to throw up a syntax error rather than just spit out the rest of the script. Maybe you just need to refresh or re-upload the file. Sometimes if I'm editing a file too quickly sometimes it doesn't work as expected. |
reference: whrl.pl/RcctdZ
posted 2010-Mar-11, 8pm AEST
|
|
User #240543 937 posts
Whirlpool Enthusiast
|
already tryed reuploading. The host is x10hosting |
reference: whrl.pl/RcctqV
posted 2010-Mar-11, 9pm AEST
|
|
User #151939 108 posts
Forum Regular
|
echo() is not actually a function so it is safer not to use parentheses with it. Try echo "<br/><br/>Message successfully sent!</p>"; |
reference: whrl.pl/RcctyE
posted 2010-Mar-11, 9pm AEST
|
|
User #166340 934 posts
Whirlpool Enthusiast
|
echo() is not actually a function so it is safer not to use parentheses with it. it works fine for me either way. I think the problem lies elsewhere in his setup/script |
reference: whrl.pl/RcctAB
posted 2010-Mar-11, 9pm AEST
|
|
User #18224 2963 posts
Whirlpool Forums Addict
|
echo() is not actually a function so it is safer not to use parentheses with it. And in this particular case, you could technically (although I wouldn't bother searching your code to change other instances) be run faster by using single quotes. In double quotes, PHP will "waste time" checking the string for any variable names so it can echo their actual value. So in theory, Sorry I couldn't help with your actual problem! |
reference: whrl.pl/RcctGM
posted 2010-Mar-11, 10pm AEST
|
|
User #76136 579 posts
Whirlpool Enthusiast
|
Is your file saved with a .php file extension? (genuine question, as I am not sure if you are a beginner or not) |
reference: whrl.pl/Rcct1p
posted 2010-Mar-11, 11pm AEST
|
|
User #166340 934 posts
Whirlpool Enthusiast
|
(that's a closing ?> which would then tell apache/iis to display the rest of the scripts code) lol then why does it display the text prior to ?> |
reference: whrl.pl/Rcct7d
posted 2010-Mar-12, 12am AEST
|
|
User #62582 2808 posts
Whirlpool Forums Addict
|
try loading the page again, and go to View->View Source or View->Page Source (or whatever variation you have, depending on your browser) and tell us exactly what you get. |
reference: whrl.pl/Rcct8F
posted 2010-Mar-12, 1am AEST
|
|
User #240543 937 posts
Whirlpool Enthusiast
|
No, it is a .html edit: Sorry, i am so dumb.... |
reference: whrl.pl/Rccvhv
posted 2010-Mar-12, 6am AEST
edited 2010-Mar-12, 7am AEST
|
|
User #18224 2963 posts
Whirlpool Forums Addict
|
lol then why does it display the text prior to ?> Read my paragraph again – closely. Now the OP has confirmed the filename is .html that was a really good guess of mine :) OP, have you tried failing the message on purpose? |
reference: whrl.pl/RccvlR
posted 2010-Mar-12, 7am AEST
|
|
User #240543 937 posts
Whirlpool Enthusiast
|
Thanks for the help, should have named it php.... |
reference: whrl.pl/Rccvl4
posted 2010-Mar-12, 7am AEST
|
|
User #342121 210 posts
Forum Regular
|
A note on php mail: Where you write: Message successfully sent! / Message delivery failed... That's not entirely accurate. mail's return value is whether the message was sent to the underlying mail delivery system successfully or not, not whether the mail was actually sent to the email address. You could run into the case where mail reports true that the message was accepted for delivery, but still fails to reach its destination. |
reference: whrl.pl/Rccvob
posted 2010-Mar-12, 7am AEST
|
|
User #166340 934 posts
Whirlpool Enthusiast
|
I'm asking if the closing tag is being incorrectly used instead of a closing < /p> doesn't appear to be in the code he pasted. If he can't copy and paste code into a window, he'll be struggling a lot. I gave him the benefit of the doubt. he also claims that the script worked before. your post was half about the usage of apostrophes vs double-quotes, which was not very helpful in his case. Sorry if i didn't bother reading properly when presented with a handful of unrelated material |
reference: whrl.pl/RccwJB
posted 2010-Mar-12, 1pm AEST
edited 2010-Mar-12, 1pm AEST
|
|
User #166340 934 posts
Whirlpool Enthusiast
|
You could run into the case where mail reports true that the message was accepted for delivery, but still fails to reach its destination. Yep. Returns TRUE if the mail was successfully accepted for delivery, FALSE otherwise. It is important to note that just because the mail was accepted for delivery, it does NOT mean the mail will actually reach the intended destination. Uhh I think you'd have to use that Receipt functionality to find out whether someone received the email or not, but that's not 100% either. I never click positively to that request, i always cancel it hehe |
reference: whrl.pl/RccwMW
posted 2010-Mar-12, 1pm AEST
|
|
User #342121 210 posts
Forum Regular
|
Or try using web bugs. :0 |
reference: whrl.pl/RccB4C
posted 2010-Mar-13, 10pm AEST
edited 2010-Mar-13, 10pm AEST
|
|
User #166340 934 posts
Whirlpool Enthusiast
|
Or try using web bugs. :0 What, little transparent gifs? You can't track 'em if the recipient doesn't load images. |
reference: whrl.pl/RccCdl
posted 2010-Mar-13, 11pm AEST
|