Follow us on Facebook
Faucibus toroot menuts
Email sending is one of the important parts of any website developer. Whether its order confirmation email or college registration form, the confirm is sent through emails and other sms etc.
So, as a developer you need to know how to send email through PHP
Send Plain Text Email:In this format of the email, we cannot use HTML tags. Only plain text email is supported in this.
In the above program you can see there is a function called mail() which takes few parameter and then sends email. Mail() is a built-in PHP function which is responsible for seining emails.
Below are the list of parameters it can take.Parameter Name Description to This represents recipient email subject Subject of the email which the user will see message This is the actual body of the message where the recipient will receive the main message. header This is an optional parameter. This is normally used for CC and BCC message sending. parameters This is also an optional parameter which is used to send extra parameters.
HTML email sending
In the above email code, it can send plain text email only but there are higher chances that we can send rich HTML email. For example newsletter, Invitation email etc. For that we will require to add HTML tags. Good thing is that it’s possible to send HTML email through PHP. For that we need to specify MIME version and Content type :
Below is the code for sending HTML email:
<title >50% Discount for new course </title >
<h2>Here are the birthdays upcoming in August! </h2 >
<th>Course name </th > <th>Duration </th > <th>Fees </th > <th>Discount </th >
<td>Mean Stack </td > <td>4 Months </td > <td>32000 </td > <td>50% </td >
<td>Java </td > <td>5 Months </td > <td>18000 </td > <td>205 </td >