Sending email in php is very easy. What we need to do is, we have to give proper email ID,subject and message in the predefined php email function. Lets see the php email syntax to get clear idea about php mail functions.
PHP Mail Syntax
PHP Mail Syntax
mail(to,subject,message,headers,parameters);here,
To | Required. Destination Email ID. |
Subject | Required. Email Subject or heading. |
Message | Required. Message to be sent. It can be in the form or normal text or HTML. |
Headers | Optional. To add cc, bcc etc. The additional headers must be separated with (\r\n). |
Parameters | Optional. |
Sample Program:
Output:
If the mail was sent successfully, then you will get output as "Success.. Email was sent to : admin@studentsblog100.in" or else you will get Error in sending php mail.
Unable to receive php emails ?
×
Note! You can't receive mails in GMAIL accounts if php is hosted in localhost. Because, Gmail auto spam messages detecting system will neglect it.
Click Here to get -- > PHP Tutorials by Studentsblog100
No comments:
Post a Comment