PHP uses the Simple Mail Transmission Protocol (SMTP) to send mail.
Settings of the SMTP mail can be done through "php.ini" file present in the PHP installation folder.
Any text editor will be used to open and edit "php.ini" file
Locate [mail function) in the file
PHP mail() Function:
PHP mail is an inbuilt PHP function which is used to send emails from PHP scripts.It is a cost-effective way of notifying users of important events.
The user gets to contact you via email by providing a contact us form on the website that emails the provided content.
It can also be used to send an email, to your newsletter subscribers, password reset links to users who forget their passwords, activation/confirmation links, registering users and verifying their email addresses
Syntax :
mail( to, subject, message, headers, parameters ); The mail function accepts the following parameters:
Example of mail() in PHP:
<!DOCTYPE html> <html> <head> <title>PHP | Sending E-mail With Example</title> </head> <body> <?php $to="shivamhande0000@gmail.com"; $sub="Learn PHP"; $msg="<br>HEY Shivam, Want to learn PHP</br>"; $header="From:business@cwipedia.in \r\n"; $retvalue=mail($to,$sub,$msg,$header); if($retvalue===true) { echo "Message is Sent"; } else { echo "Message is not sent"; } ?> </body> </html>
Comments
Post a Comment
If you have any query, please let us know