我正在尝试编写 HTML 电子邮件并使用 PHP(wp_mail
确切地说)将其关闭。
它在 gmail 客户端中运行良好,但如果我在 Apple Mail 中打开它,我的 foreach 内容最终会出现在电子邮件的底部,这是不好的。
我正在创建电子邮件的消息部分,$message .= '';
用于添加新的内容。当我到达时,foreach
我正在这样做:
$message .= '<tr style="padding: 20px 10px; width: 100%; display: inline-block;">
<td valign="top" style="width:100%; display:block;"><table width="100%" border="0" cellspacing="0" cellpadding="0" style="color: #767572; padding: 10px;">
<tr>
<td style="font-family: Helvetica, Arial, sans-serif; line-height: 130%; color: #767572;">';
foreach( $event_query->posts as $post ) : ?>
<?php
$eventlink = get_permalink();
$title = get_the_title();
$message .= '<div class="event clearfix">';
$message .= '<div class="event-image grid-1-4 no-padding">';
$message .= '<h2><a href="'.$eventlink.'">'.$title.'</a></h2>';
?>
之后endforeach
有更多内容签署电子邮件。但是在 Apple Mail 上,foreach 会在电子邮件结束后显示。
有任何想法吗?