Page 1 of 1

can i send emails using localhost only

Posted: Sun Apr 13, 2008 4:21 am
by Boorah
hello,
Iwrote a php code to send email, but it did'nt work i always get this message
Warning: mail() [function.mail]: SMTP server response: 530-5.5.1 Authentication Required. Learn more at 530 5.5.1 http://mail.google.com/support/bin/answ ... swer=14257 s10sm6671141muh.11
I searched a lot about the reason but I couldn't find a satisfying answer, i really need to know what to do, do i have to replace the the smtp=localhost in phpini with the smtp name of my internet service provider,
or is it enough to use localhost to do this job,I hope that I get an answer
:banghead:

Re: can i send emails using localhost only

Posted: Sun Apr 13, 2008 12:34 pm
by skuray
PHP mail function needs certain configuation settings in php.ini file like the SMTP host name, smtp port and the path to sendmail(for unix env)

Windows configuation

SMTP : localhost
smpt_port : 25
;Path to sendmail /usr/sbin/sendmail -t -i

Unix Configuration

SMTP : localhost
smpt_port : 25
Path to sendmail /usr/sbin/sendmail -t -i

Sending mail with extra headers.
<?php
mail("nobody@example.com", "the subject", $message,
"From: webmaster@{$_SERVER['SERVER_NAME']}\r\n" .
"Reply-To: webmaster@{$_SERVER['SERVER_NAME']}\r\n" .
"X-Mailer: PHP/" . phpversion());
?>
If you have hosted your site and don't have access to php.ini file, please contact your system administrator to configure the php.ini file.

visit http://www.skuray.com

Re: can i send emails using localhost only

Posted: Mon Apr 14, 2008 1:25 am
by Chris Corbyn
Swift Mailer will allow you to use an SMTP server which requires a username and password. It sounds like you're trying to do this from your windows computer however which will probably cause you to be blocked as spam if your IP address is dynamically allocated.