How to send mail in PHP (PHP में मेल कैसे भेजें) ?
- Send email message is a very easy task in PHP language (PHP भाषा में ईमेल संदेश भेजना बहुत आसान काम है।). The PHP code is given bellow-
<?php
$to = 'abc12340@gmail.com,defg12340@gmail.com'; // you can add more than one email address with comma
// mail Subject
$subject = 'Wedding Wishes of Friend';
// mail Message
$email_message = '
<html>
<head>
<title>Wedding Wishes of Friend</title>
</head>
<body>
<p>Wedding Wishes of Friend</p>
<table>
<tr>
<th>Name</th><th>Class</th>
</tr>
<tr>
<td>Ashok</td><td>B.Tech</td>
</tr>
</table>
</body>
</html>
';
// To send HTML mail
$headers[] = 'MIME-Version: 1.0';
$headers[] = 'Content-type: text/html; charset=iso-8859-1';
// you can add additional headers
$headers[] = 'To: Ashok <ashok123@example.com>, Rams <rams123@example.com>';
$headers[] = 'From: Wedding Wishes of Friend <weddingpro@example.com>';
$headers[] = 'Cc: ashok12356780@example.com';
$headers[] = 'Bcc: ashok876543210@example.com';
// Mail function
mail($to, $subject, $email_message, implode("\r\n", $headers));
?>- In the above code, mail( ) function is a built in function of PHP language (उपरोक्त कोड में, mail() फ़ंक्शन PHP भाषा का एक अंतर्निहित फ़ंक्शन है।).
- mail($to, $subject, $email_message, $headers); this function requires minimum 4 parameters which is given in code (इस फ़ंक्शन को न्यूनतम 4 पैरामीटर की आवश्यकता होती है जो कोड में दिए गए हैं।) .
- The $email_message variable shows send the HTML mail ($email_message चर HTML मेल भेजने को दर्शाता है।).
$headers[] = 'To: Ashok <ashok123@example.com>, Rams <rams123@example.com>';
$headers[] = 'From: Wedding Wishes of Friend <weddingpro@example.com>';
$headers[] = 'Cc: ashok12356780@example.com';
$headers[] = 'Bcc: ashok876543210@example.com';- The header section define the BCC and CC mails (हेडर अनुभाग बीसीसी और सीसी मेल को परिभाषित करता है।).
How to send mail message in PHP
Tags: How to send email in PHP, How to send mail in PHP, PHP send mail, Send HTML email in PHP, Using PHP send an email
