Jump to content

using php mail function


anirudhtomer

Recommended Posts

HI everyone I am a beginner in PHP

 

I was trying to use the PHP mail() function to send mail.

after hours of search on various forums i got a few basic things that I need a SMTP server installed on my machine (by now I've got what SMTP is)...now the problem is mostly all forums are suggesting me to use Softwares like PHP-Mailer, which I don't want to use until I get to know how PHP uses its "mail()" function to send emails from "localhost" (by editing PHP.ini file)

 

Can I send mails by just making some simple changes in my php.ini file & using the mail function to send mail from localhost

 

if not then why the "mail()" function is there in PHP...when the job can be done by using some softwares like PHP-Mailer as suggested by http://www.vishalkumar.in/2009/06/php-mail-using-gmail-smtp-tutorial/

 

 

Please help me out, I need guidance & I am very much eager to learn this stuff

or any link to a good tutorial that can resolve my problem

Link to comment
https://forums.phpfreaks.com/topic/194914-using-php-mail-function/
Share on other sites

The mail() function is extremely basic. It can't do SMTP authentication, but you technically should have to since most SMTP servers on localhost (your machine) would allow emails to be sent from itself without authentication.

 

If you are looking for a SMTP server, there are plenty of free ones out there. Just google "free SMTP server". If you have a SMTP server on the localmachine, nothing in the php.ini file should have to be changed (I think).

As you said, I don't think it's possible to send email without a SMTP server.

 

http://www.php.net/manual/en/mail.configuration.php shows you the configuration options. You could technically use a different SMTP server, but it would most likely require SMTP authentication as most servers do not allow relaying.

 

If you need a more advanced mail function, try the pear package PEAR::Mail.

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.