Jump to content

I need help with mail() PLEAAAAAAAAASE


sln7

Recommended Posts

Hi folks,

 

This might be the easiest question you've ever answered.. I would like to know how the mail() function works, as when I run the following script I am getting an error:

 

<?php

ini_set('SMTP', 'localhost');

ini_set('smtp_port', '25');

$to      = '[email protected]';

$subject = 'the subject';

$message = 'hello';

$headers = 'From: [email protected]' . "\r\n" .

    'Reply-To: [email protected]' . "\r\n" .

    'X-Mailer: PHP/' . phpversion();

 

if (mail($to, $subject, $message, $headers)) { echo "success"; } else { echo "failed"; }

?>

 

The error that I am getting is:

[Tue Apr 03 00:12:26 2007] [error] [client 127.0.0.1] PHP Warning:  mail() [<a href='function.mail'>function.mail</a>]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\\Work\\Mysite\\mailAction.php on line 11

 

so basially i would like to know how i can send an email using my localhost.. PLEASE HELP

 

 

Link to comment
https://forums.phpfreaks.com/topic/45376-i-need-help-with-mail-pleaaaaaaaaase/
Share on other sites

Thanks for the information. I was given smtphm.sympatico.ca as my smtp server by my isp. So i tried setting my smtp to that (SMTP = smtphm.sympatico.ca in PHP.ini), and ran my code again.. but no luck.. Is there anything else that I need to configure?

 

Thanks,

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.