Send Email from PHP

How to send email with php using mail and mb_send_mail ...

There is no php coding required when using Arclab Web Form Builder.
The following should illustrate how to send an email from php in general:


What the difference between php mail and mb_send_mail?



How to call it?

The syntax is much the same:



bool mail ( string $recipient , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )



bool mb_send_mail ( string $recipient , string $subject , string $message [, string $additional_headers [, string $additional_parameter ]] )

Text Message Sample Code:

$recipient = 'recipient@yourdomain.tld';
$headers = 'From: sender@yourdomain.tld';
$subject = 'Hello World';
$message = 'This is a test';
mail ($recipient, $subject, $message, $headers);


HTML Message Sample Code:

$recipient = 'recipient@yourdomain.tld';
$headers = 'From: sender@yourdomain.tld';
$headers .="MIME-Version: 1.0\r\nContent-Type: text/html; charset=iso-8859-1"
$subject = 'Hello World';
$message = '<html><body><h1>This is a test</h1></body></html>';
mail ($recipient, $subject, $message, $headers);


Add the MIME-Version and the Content-Type to the mail header if you want to send a message in HTML format.
The MIME-Version is 1.0 and the Content-Type is "text/html" for a HTML message.
In this sample we use the charset "iso-8859-1" ... if you want to use mb_send_mail, set the charset to "utf-8" instead.

Disclaimer: The information on this page is provided "as is" without warranty of any kind. Further, Arclab Software OHG does not warrant, guarantee, or make any representations regarding the use, or the results of use, in terms of correctness, accuracy, reliability, currentness, or otherwise. See: License Agreement