मैंने मंड्रिल में एक टेम्पलेट बनाया है लेकिन मुझे नहीं पता कि ईमेल भेजने के लिए उपयोग कैसे करें।टेम्पलेट के साथ ईमेल भेजें (मैनरिल PHP)
<?php
include_once "swift_required.php";
$subject = 'Hello from Mandrill, PHP!';
$from = array('[email protected]' =>'Your Name');
$to = array(
'[email protected]' => 'Recipient1 Name',
'[email protected]' => 'Recipient2 Name'
);
$text = "Mandrill speaks plaintext";
$html = "<em>Mandrill speaks <strong>HTML</strong></em>";
$transport = Swift_SmtpTransport::newInstance('smtp.mandrillapp.com', 587);
$transport->setUsername('MANDRILL_USERNAME');
$transport->setPassword('MANDRILL_PASSWORD');
$swift = Swift_Mailer::newInstance($transport);
$message = new Swift_Message($subject);
$message->setFrom($from);
$message->setBody($html, 'text/html');
$message->setTo($to);
$message->addPart($text, 'text/plain');
if ($recipients = $swift->send($message, $failures))
{
echo 'Message successfully sent!';
} else {
echo "There was an error:\n";
print_r($failures);
}
?>
धन्यवाद, यह काम कर रहा है, बस एक सुधार: $ mandrill = नया मंड्रिल ('YOUR_API_KEY'); – Marckaraujo
एक और जानकारी, मैंने सेट किया है * | pspReference | * HTML टेम्पलेट के अंदर और merge_vars में मैंने उपयोग किया: 'name' => 'pspReference', 'content' => 'हैलो वर्ल्ड'), लेकिन यह नहीं बदलता मूल्य, क्या आप जानते हैं क्यों? धन्यवाद – Marckaraujo
@Marckaraujo क्या आप दिखा सकते हैं कि आपका टेम्पलेट कैसा दिखता है? – MrCode