can i send emails using localhost only

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
Boorah
Forum Newbie
Posts: 1
Joined: Sun Apr 13, 2008 4:09 am

can i send emails using localhost only

Post 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:
skuray
Forum Newbie
Posts: 1
Joined: Sun Apr 13, 2008 12:14 pm

Re: can i send emails using localhost only

Post 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
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: can i send emails using localhost only

Post 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.
Post Reply