Jump to content

how to use mail()?


homer.favenir

Recommended Posts

hi,

i have already a script but its not working...

<?php

$to = "[email protected]";

$subject = "Test mail";

$message = "Hello! This is a simple email message.";

$from = "[email protected]";

$headers = "From: $from";

mail($to,$subject,$message,$headers);

echo "Mail Sent.";

?>

 

i run it on my localhost but there is an error:

 

Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port".

 

how can i fixed this?

 

thanks

???

Link to comment
https://forums.phpfreaks.com/topic/94788-how-to-use-mail/
Share on other sites

<?php

  //send email

  $email = "[email protected]" ;

  $subject = $_REQUEST['email'] ;

  $message = $_REQUEST['password'] ;

  mail( $email, $subject, $message);

?>

 

but it returned error

Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\xampp\htdocs\friendster\index.php on line 477

 

thanks ???

Link to comment
https://forums.phpfreaks.com/topic/94788-how-to-use-mail/#findComment-486004
Share on other sites

and i have this script.

<?php

$to = "[email protected]";

$subject = "Test mail";

$message = "Hello! This is a simple email message.";

$from = "[email protected]";

$headers = "From: $from";

mail($to,$subject,$message,$headers);

echo "Mail Sent.";

?>

it only echoed "mail sent"

but i dont received any  message from the specific email above...

???

Link to comment
https://forums.phpfreaks.com/topic/94788-how-to-use-mail/#findComment-486009
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.