SN1P3R_85 Posted August 28, 2008 Share Posted August 28, 2008 hey everyone, I am fairly new with using php, and felt the need to have an email sent for something on my website. If the email was sent, I had it print "the email was sent successfully" on the screen. It does this every time I send the code, but when i check my inbox, there is no email in it. I then made a test file, to see if there was something wrong with my code. The test file contains this: <?php $to = "[email protected]"; $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>"); } ?> I've ran this code several times, and havn't gotten an email . Every time I run it, I get the "Message successfully sent!", so I don't understand why I'm not recieving the email. Do any of you guys know what this might be? any help is appreciated. -SN1P3R_85 Link to comment https://forums.phpfreaks.com/topic/121645-sending-an-email-in-php/ Share on other sites More sharing options...
The Little Guy Posted August 28, 2008 Share Posted August 28, 2008 are you using your own computer as a server, or are you using a server that is on the internet, such as a web host? Link to comment https://forums.phpfreaks.com/topic/121645-sending-an-email-in-php/#findComment-627533 Share on other sites More sharing options...
SN1P3R_85 Posted August 28, 2008 Author Share Posted August 28, 2008 oh, i can't believe i left that out, My site is hosted on a webserver. Im pretty sure the mail() function is installed on it. Link to comment https://forums.phpfreaks.com/topic/121645-sending-an-email-in-php/#findComment-627535 Share on other sites More sharing options...
dezkit Posted August 28, 2008 Share Posted August 28, 2008 does your host use cpanel? Link to comment https://forums.phpfreaks.com/topic/121645-sending-an-email-in-php/#findComment-627537 Share on other sites More sharing options...
SN1P3R_85 Posted August 28, 2008 Author Share Posted August 28, 2008 i am not sure. I am currently trying to get ahold of the server owner,(a friend of a friend kinda thing). Is there a way for me to check? Link to comment https://forums.phpfreaks.com/topic/121645-sending-an-email-in-php/#findComment-627539 Share on other sites More sharing options...
The Little Guy Posted August 28, 2008 Share Posted August 28, 2008 make sure you spelled your email correctly. Link to comment https://forums.phpfreaks.com/topic/121645-sending-an-email-in-php/#findComment-627543 Share on other sites More sharing options...
SN1P3R_85 Posted August 28, 2008 Author Share Posted August 28, 2008 ya, i checked it thoroughly. Its exact same. Link to comment https://forums.phpfreaks.com/topic/121645-sending-an-email-in-php/#findComment-627544 Share on other sites More sharing options...
SN1P3R_85 Posted August 28, 2008 Author Share Posted August 28, 2008 if any of u guys have a website or something, would u mind using my script, and inserting your email addresses, and telling me if it works. Link to comment https://forums.phpfreaks.com/topic/121645-sending-an-email-in-php/#findComment-627545 Share on other sites More sharing options...
The Little Guy Posted August 28, 2008 Share Posted August 28, 2008 Works on my server, must be your server. Link to comment https://forums.phpfreaks.com/topic/121645-sending-an-email-in-php/#findComment-627547 Share on other sites More sharing options...
SN1P3R_85 Posted August 28, 2008 Author Share Posted August 28, 2008 Link to comment https://forums.phpfreaks.com/topic/121645-sending-an-email-in-php/#findComment-627548 Share on other sites More sharing options...
SN1P3R_85 Posted August 28, 2008 Author Share Posted August 28, 2008 do any of you guys have any advice for what i should do? My knowledge of how PHP settings work, and even how to locate them is very small. I would appreciate any advice. What may seem obvious to you guys may have never even crossed my mind. Link to comment https://forums.phpfreaks.com/topic/121645-sending-an-email-in-php/#findComment-627551 Share on other sites More sharing options...
SN1P3R_85 Posted August 28, 2008 Author Share Posted August 28, 2008 i got ahold of the guy. He won't let me use the mail() function for some stupid reason. Srry for wasting all your guy's time. Link to comment https://forums.phpfreaks.com/topic/121645-sending-an-email-in-php/#findComment-627556 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.