...

View Full Version : setup mail questions thanks



melnet
07-12-2007, 03:39 PM
Hello

when i run the main.php, it has some errors.


Code here:
<?php
$body="<em>HTML</em> formatted <strong>Message</strong";

$headers = "From: info@example.com \r\n";
$headers.= "Content-Type: text/html; charset=ISO-8859-1 ";
$headers .= "MIME-Version: 1.0 ";
/*notice there aren't any \r\n after the second two header additions. This is what made this version work correctly*/
mail("abc@abc.com", "An HTML Message", $body, $headers);
?>

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:\AppServ\www\refer\mail.php on line 8

in php.ini, i delete the ";" for set up php_imap.dll(extension=php_imap.dll)
and in php5\ext, there are php_imap.dll

however i need what files to setup or what code to write?
thanks

ess
07-12-2007, 03:59 PM
Hi melnet

This error is generated because you have not configured your SMTP server. So, the first thing you need to do is to ask yourself "Do I have an SMTP Server I can use?"

Since you have access to the internet, chances are that your ISP already has an SMTP server which you can use. So, if you don't know it...contact them and find out your SMTP server.

Once you have an SMTP server you can use, you can do either of the following.

Option 1
Locate php.ini file...open it...and find the following line (around line 696)

SMTP = localhost

Replace "localhost" with your SMTP server (the one you just got from your ISP)...restart your server...and you are done

Option 2
At the top of the PHP file that you are using to send emails (the file that has the mail() function), add the following line.
ini_set('SMTP','LOCALHOST');

replace LOCALHOST with your SMTP server.

That is it.

Test the script and let's know if you are still having problems.

Cheers,
Ess

melnet
07-12-2007, 07:58 PM
now i download free smtp server software at softstack
when i run the php code, it gets some errors.

Warning: mail() [function.mail]: SMTP server response: 550 Invalid recipient: colokit@hotmail.com in C:\AppServ\www\refer\mail.php on line 7

Fatal error: Maximum execution time of 30 seconds exceeded in C:\AppServ\www\refer\mail.php on line 8


<?php
$body="<em>HTML</em> formatted <strong>Message</strong";

$headers = "From: info@example.com \r\n";
$headers.= "Content-Type: text/html; charset=ISO-8859-1 ";
$headers .= "MIME-Version: 1.0 ";
mail("colokit@hotmail.com", "An HTML Message", $body, $headers);
?>

and the smtp server also get errors msg:disconnected
where do i need to setup wrong function?

Thanks

ess
07-12-2007, 09:27 PM
Have you configured your php.ini file like I suggested? and restarted your server?

If you have and that is the error you are getting...I can only guess that relaying on your SMTP server is not turned on for your IP address. Unless you turn it on...I am afraid the built in mail() function will not work.

If you are using 1st Mail Server....I am afraid I cannot help you as I have never used it before. Read the documentation if there is any...and see if it is possible to turn relaying on for your localhost. Otherwise, I would suggest that you contact them and see if they provide support since it is not free software.

Another solution which I have never used in the past is to try out the following open source class....where it should do the relaying for you...provided your set it up correctly.
http://www.phpclasses.org/browse/package/14.html

They also have a support forum which you might find helpful.

Hope that helps.

Cheers,
Ess



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum