Jump to content

mail


jkkenzie

Recommended Posts

Am getting this error "

Warning: mail() [function.mail]: 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:\wamp\www\Mail\index.php on line 40"

with the code below to send mail using my local intranet machine.

<?php 
/* Setup your Subject and Message Body */ 
$subject='Testing PHP Email'; 
$body='Put Your Text Message Here.'; 

/* Specify your smtp Server, Port and Valid From Address */ 
ini_set('smtp','localhost'); 
ini_set('smtp_port',25); 
ini_set('sendmail_from','[email protected]'); 

/* Additional Headers */ 
$headers = 'Cc:Real CC Name <[email protected]>'."\r\n"; 
$headers .= 'Bcc:Real BCC Name <[email protected]>'."\r\n"; 

/* Try to send message and respond if it sends or fails. */ 
if(mail ('ToPersonsName <[email protected]>', $subject, $body, $headers )){ 
echo "<h2>Your Message was sent!</h2>"; 
} 
else{ 
echo "<font color='red'><h2>Your Message Was Not Sent!</h2></font>"; 
} 
exit; 
?>

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

  • 2 weeks later...

Hi! guys,

What is a mail server ?

I have WAMP installed, how can WAMP work with XAMP?

 

I dont the errors are with ini file, everything is set, SMTP = localhost PORT = 25, what else does it need here.

 

The error again is here:

Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set()

 

 

Link to comment
https://forums.phpfreaks.com/topic/126885-mail/#findComment-663883
Share on other sites

Wamp is windows apache and mysql. you have no ftp server so when ur php scvript neeeds to do an ftp you cant do it but you can use php function upload file. an ftp is a when u use and account on that computer to upload and download files its standard. you need to install xamp it will work whilst WAMP is installed but will take over ur apache , basicaly get rid of what u got install XAMP its an all in one

Link to comment
https://forums.phpfreaks.com/topic/126885-mail/#findComment-664471
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.