Ivin
Ivin

Reputation: 4815

Send mail from PHP with minimum 3rd party services?

Dont ignore if this sounds like a duplicate. I went through similar questions here but couldnt resolve my doubts.

Im developing a site in my localhost. Its coded in PHP. I need to send mail to my site's customers from my PHP script. I know we can use gmail smtp server for this. But due to the limit on the mail/day set by google, i prefer not to use them.

But my doubts are:

  1. Can i do it without gmail's smtp server or anyone else's smtp server?
  2. What all components would i need to send mails from my localhost as well as from my online webserver?
  3. Does all the webservers come pre-configured to enable us to send mail from site?
  4. What is sendMail, phpMailer, pearMail etc.? I've been advised to use them. But what are they?

Thanks a lot!

EDIT: Im using wamp2.2 in my localhost.

Upvotes: 1

Views: 1323

Answers (3)

McLosys Creative
McLosys Creative

Reputation: 759

to send email from php , simply use php's own mail function :

 <?php

             $to = "destinationemailid";

             $subject = "mail subject";

             $message = "your message to send";

             $from =  "sourceemailid";

             $headers = "From:" . $from;

             mail($to,$subject,$message,$headers);



        ?>

this works with xampp on localhost

Upvotes: 0

asprin
asprin

Reputation: 9833

If you use XAMPP, it comes with Mercury Mail. You can use that to send mails through localhost.

Upvotes: 2

KingCrunch
KingCrunch

Reputation: 132011

  1. Of course
  2. Setup an own MTA (Mail Transport Agent) like postfix.
  3. In my experience the shared hosts usually already offers a mail agent. If you really mean "webserver", than no: A webserver is a webserver. Preconfigured packages like XAMPP usually also comes with a MTA.
  4. Libraries to send mail. sendMail could be sendmail, which is itself a MTA-interface.

Upvotes: 1

Related Questions