Jump to content

sending an email in php


SN1P3R_85

Recommended Posts

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

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.