我真的在这件事上大发雷霆。为什么它不会发送?我觉得有点$recipient
来自$var
我没有得到的价值。相同的行项目用于创建帖子,这很有效,所以我不认为是它们。任何帮助都将不胜感激。
function ecard_email_send(){
$sitename = get_bloginfo(\'name\');
$siteurl = site_url();
$cardurl = ($siteurl . \'/\' . $post_title);
$recipient = esc_attr($lineItem[\'recipient_email\']);
$headers = array(\'Content-Type: text/html; charset=UTF-8\');
$subject = ($lineItem[\'sender_name\'] . \' has sent you an Ecard from \' . $sitename);
$sitename = get_bloginfo(\'name\');
$siteurl = site_url();
$cardurl = ($siteurl . \'/\' . $post_title);
$content = array(
\'name\' => $lineItem[\'recipient_name\'],
\'verse\' => $lineItem[\'ecard_message\'],
\'greeting\' => $lineItem[\'ecard_greeting\'],
\'closing\' => $lineItem[\'ecard_closing\'],
\'sender\' => $lineItem[\'sender_name\'],
\'image\' => $ecardbackground[0],
\'link\' => $cardurl,
\'value\' => \'View your card online\'
) ;
ob_start();
include(MY_PLUGIN_PATH . \'/templates/ecard_email.php\');
$message = ob_get_contents();
ob_end_clean();
$status = wp_mail( $recipient, $subject, $message, $headers );
exit();
}
这是我的模板编辑-或者可能不是格式不对:
<?php /*email template tester */
echo </pre>
!doctype html
body
div
table role="presentation" align="center" border="0" cellpadding="0" cellspacing="0" width="100%"
tr
td valign="middle" style="text-align: center; padding: 40px; font-family: sans-serif; font-size: 15px; mso-height-rule: exactly; line-height: 20px; color: #ffffff;"
`\'.$content[\'verse\'].\'`
/td
/tr
tr
td valign="middle" style="text-align: center; padding: 40px; font-family: sans-serif; font-size: 15px; mso-height-rule: exactly; line-height: 20px; color: #ffffff;"
`\'.$content[\'closing\'].\'`
</td>
</tr><tr>
<td valign="middle" style="text-align: center; padding: 40px; font-family: sans-serif; font-size: 15px; mso-height-rule: exactly; line-height: 20px; color: #ffffff;">
\'.$content[\'closing\'].\'
/td>
/tr
/table
/div
/body
/html `\';`
?>