Friday, 19 April 2013

PHP E-mail


Sending E-mail with PHP.
With PHP we can directly send e-mail using script.

Maill function () in PHP.
Function mail () in use to send email.
Syntax.
mail (to, subject, message, headers, parameters);
Penjelasa:
to: the recipient email address.
subject: title of the e-mail is sent.
message: The content / message.
header: is additional like from, CC and Bcc.
parameters: Options. Additional mail program that is in use.
Note: In order to function mail () to work, you need to setting wed your server or php.ini or contact support to do the configuration.
example:
$ to = 'sample@yahoo.com'
$ subject = 'Test Mail';
$ message = 'Attempt Sending E-mail using PHP';
$ from = 'no-replay@yahoo.com';
$ headers = "From: $ from";
mail ($ to, $ subject, $ message, $ headers);
echo 'E-mail Sent';

No comments:

Post a Comment