Jump to content

mail wont work


patchido
 Share

Recommended Posts

well, i have a hosting site and i enter via cpanel,(just in case it matters)

 

and i am trying to use the mai() function but it won't work.. :S

 

 

this is my code

 

<?php
$to = "pato.llaguno@gmail.com";
$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>");
  }
?>

 

 

the output is

 

Message successfully sent!

 

 

but i don't get any mail in the adress specified :S

 

Link to comment
Share on other sites

<?php
$to      = 'pato.llaguno@gmail.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
    'Reply-To: webmaster@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

if(mail($to, $subject, $message, $headers)){
echo("<p>Message successfully sent!</p>");
  } else {
   echo("<p>Message delivery failed...</p>");
  }
?>

 

 

same thing :S

Link to comment
Share on other sites


<?php 
   $from    = "PHP Freak";
   $headers = "MIME-Version: 1.0\r\n";
   $headers.= "Content-type: text/html; charset=iso-8859-1\r\n";
   $headers.= "From: $from\r\n";

   $to = "pato.llaguno@gmail.com"; 
   $subject = "Email send!"; 
   $body = "Hi,Email working?"; 
   if (mail($to, $subject, $body,$headers)) 
  {   echo("<p>Message successfully sent!</p>");  } 
  else 
{   echo("<p>Message delivery failed...</p>");  }


?>


Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • 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.