error in subscription email

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
cali_dotcom
Forum Commoner
Posts: 49
Joined: Fri Aug 22, 2008 7:28 pm
Location: Rancho Cucamonga, CA

error in subscription email

Post by cali_dotcom »

hi, i just tried to add the email function to my website so that when users sign in the recieve an email but i keep getting this error. does anybody know what's wrong:

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 E:\Program Files\wamp\www\practice\sbdjobs\signup11.php on line 110

here is the code that contains the email function:

[ICODE]
//start building signup email
$msg = "<p><b>Name:</b> '.$fname. ''.$lname.'</p>";
$msg .="<p><b>Company Name:</b> '.$compname.'</p>";
$msg .="<p>Thank you for signing up with sbdjobs.com. You can log in anytime to add, edit or view jobs</p>";
$to = "'.$fname. ''.$lname.'<'.$con_email.'>";
$subject = "Registration with sbdJobs.com";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: sbdJobs.com' . "\r\n";
$headers .="'.$fname. ''.$lname.'<'.$con_email.'>";

//send mail
mail($to, $subject, $msg, $headers);



[/ICODE]
everything worked fine before i added this function. my php ini file looks like this:

[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

; For Win32 only.
;sendmail_from = tochi2k@hotmail.com


can anyone tell me what i did wrong.
thanks..
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: error in subscription email

Post by jaoudestudios »

Are you running WAMP?

Do you have a mailserver installed? If not then you cant use
SMTP = localhost
cali_dotcom
Forum Commoner
Posts: 49
Joined: Fri Aug 22, 2008 7:28 pm
Location: Rancho Cucamonga, CA

Re: error in subscription email

Post by cali_dotcom »

jaoudestudios wrote:Are you running WAMP?

Do you have a mailserver installed? If not then you cant use
SMTP = localhost

i'm running wamp. i do not have a mail server installed but i thought i should be able to do it with wamp alone.
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: error in subscription email

Post by jaoudestudios »

Unfortunately NOT. Windows sucks right!?!!?!

You would need to install a separate mailserver or use a remote one.

Or better yet install Linux, which will have LAMP and a mailserver!
Post Reply