The mail() function allows you to send emails, as long as the server has a fully-functional email system already set up.
This function accepts five different parameters, only four of which we will discuss here, and only three of which are required.
Parameter | Importance | Description |
---|---|---|
to | Required | Recipient(s) of Email |
subject | Required | Subject of Email |
message | Required | Message Body of Email |
headers | Optional | From, Reply-To, CC, BCC, Date, Etc. |
Listed in order of appearance, the parameters are: mail(to,subject,message,headers)
One of the most simple examples of the mail() function is:
The addition of headers allows you to specify who the email is from and who should be copied and/or blind copied on an email
HTML emails can be sent by specifying the appropriate content-type in the header.
Leave A Comment