alexa

Sending email from your website (PHP mail)


test
test
test
You are reading   Back To Support

Knowledge Base Tutorials

Sending email from your website (PHP mail)

Php mail is one of the in built php function which helps us sending email direct from a php script. We can send an email from a website with the help of PHP mail() function.

Now the question is why we need this function ?

  • Sometimes we want to inform our users about registration confirmation or password reset etc..
  • Even as a developer we sometimes wish to stay updated about any kind of error log etc..

How to integrate:

It’s very easy function require 3 parameters to send an email from any php script. Here is the syntax

<?php

mail("email@domain.com","subject",”message”);

?>

Just replace the email id with the one you wish to send, the subject and message and done.

Next time when you run your script, it’ll send an email to the email id specified by you previously.

You can also send email using an external email service. In my previous article I have written about how to send an email with Gmail SMTP which includes what are the configuration required to send email via Gmail SMTP.

Still have questions? Check our forum!
test
test
test