नॉलेजबेस · ईमेल

PHPMailer का उपयोग करके ईमेल (SMTP) भेजना

अंतिम अपडेट 2020-04-05

1) सबसे पहले डाउनलोड करें PHP Mailer क्लास और डॉक्यूमेंटेशन।

2) class.smtp.php और class.phpmailer.php दोनों को अपने वेब स्पेस पर अपलोड करें।

3) test.php बनाएँ और फ़ाइल के अंदर निम्नलिखित कोड डालें

<?
require ('class.phpmailer.php');

$mail = new PHPMailer();
$mail->IsSMTP();
$mail->From = "mail@domain.com";;
$mail->FromName = "Your Name";
$mail->Host = 'mail.domain.com';
$mail->SMTPAuth = true;
$mail->Username = 'mail@domain.com';
$mail->Password = '********';
$mail->AddAddress("dest@domain.com", "His name");
$mail->Subject = "Here is the subject";
$mail->Body = "This is the message body";
if($mail->Send())
{
echo "email sent";
exit;
}
echo "There was an error sending the message";
?>


4) पैरामीटर बदलें

5) test.php चलाएँ

सभी ज्ञान आधारित लेख

Tell us what you need

Compare available plans or describe your workload so we can discuss a suitable starting point.