如何在电子邮件中添加<! - message - >进行解析?

时间:2015-03-11 22:14:05

标签: php email parsing

我正在编写一个代码,该代码将用户回复自动消息并解析之前的任何讨论。然后获取新电子邮件的正文并将其插入数据库。

我以为我可以将<!-- This is the message break -->添加到我的邮件的最顶部,从那里我可以在阅读电子邮件时删除此短语下的任何内容。用这样的东西  $newReply = strstr($message, '<!-- This is the message break -->',true);

但由于某种原因,电子邮件服务器似乎正在删除我添加的(ie. <!-- This is the message break -->)分页符,但我无法在电子邮件中找到它。

以下是使用php mail()函数将其作为电子邮件发送的html代码。

<!-- This is the message break -->
<html>
<body>

<table rules="all" style="padding: 10px; line-height: 1.42857143; vertical-align: Middle; border: 5px solid #1A1A1C; width: 780px; border-collapse: collapse; border-spacing: 0;" cellspacing="0">
<tr>
<td colspan="2" style="text-align: center; background-color: #1A1A1C; color: #fff;  padding: 5px;">Need to respond? Just hit reply, a responses will be appended to ticket details automatically</td>
</tr>

<tr>
<td width="100" style="color: #333333; font-weight: bold;  border-top: 1px solid #DBDBDB; border-right: 1px solid #DBDBDB; border-bottom: 1px solid #DBDBDB; border-left: 5px solid #1A1A1C; background-color: #F0F0F0;">Subject</td>
<td style="color: #333333;   border-top: 1px solid #DBDBDB; border-right: 5px solid #1A1A1C; border-bottom: 1px solid #DBDBDB; border-left: 1px solid #DBDBDB;  background-color: #F0F0F0;">'.strip_tags($ticketInfo['title']).'</td>
</tr>

<tr>
<td width="100" style="color: #333333; font-weight: bold;  border-top: 1px solid #DBDBDB; border-right: 1px solid #DBDBDB; border-bottom: 1px solid #DBDBDB; border-left: 5px solid #1A1A1C;">Ticket #</td>
<td style="color: #333333;   border-top: 1px solid #DBDBDB; border-right: 5px solid #1A1A1C; border-bottom: 1px solid #DBDBDB; border-left: 1px solid #DBDBDB; ">'.$ticketInfo['issue_id'].'</td>
</tr>

<tr>
<td width="100" style="color: #333333; font-weight: bold;  border-top: 1px solid #DBDBDB; border-right: 1px solid #DBDBDB; border-bottom: 1px solid #DBDBDB; border-left: 5px solid #1A1A1C; background-color: #F0F0F0;">Notification</td>
<td style="color: #333333;   border-top: 1px solid #DBDBDB; border-right: 5px solid #1A1A1C; border-bottom: 1px solid #DBDBDB; border-left: 1px solid #DBDBDB;  background-color: #F0F0F0;">'.$ticketInfo['notificationType'].'</td>
</tr>

<tr>
<td width="100" style="color: #333333; font-weight: bold;  border-top: 1px solid #DBDBDB; border-right: 1px solid #DBDBDB; border-bottom: 1px solid #DBDBDB; border-left: 5px solid #1A1A1C;">Status</td>
<td style="color: #333333;   border-top: 1px solid #DBDBDB; border-right: 5px solid #1A1A1C; border-bottom: 1px solid #DBDBDB; border-left: 1px solid #DBDBDB; ">'.$ticketInfo['ticketStatus'].'</td>
</tr>

<tr>
<td width="100" style="color: #333333; font-weight: bold;  border-top: 1px solid #DBDBDB; border-right: 1px solid #DBDBDB; border-bottom: 1px solid #DBDBDB; border-left: 5px solid #1A1A1C; background-color: #F0F0F0;">Priority</td>
<td style="color: #333333;   border-top: 1px solid #DBDBDB; border-right: 5px solid #1A1A1C; border-bottom: 1px solid #DBDBDB; border-left: 1px solid #DBDBDB;  background-color: #F0F0F0;">'.$ticketInfo['priority']. ' - ' . $ticketInfo['ticket_type'] .'</td>
</tr>

<tr>
<td width="100" style="color: #333333; font-weight: bold;  border-top: 1px solid #DBDBDB; border-right: 1px solid #DBDBDB; border-bottom: 1px solid #DBDBDB; border-left: 5px solid #1A1A1C;">Ticket Assigned To</td>
<td style="color: #333333;   border-top: 1px solid #DBDBDB; border-right: 5px solid #1A1A1C; border-bottom: 1px solid #DBDBDB; border-left: 1px solid #DBDBDB; ">'.$ticketInfo['assigned_to'].'</td>
</tr>

<tr>
<td width="100" style="color: #333333; font-weight: bold;  border-top: 1px solid #DBDBDB; border-right: 1px solid #DBDBDB; border-bottom: 1px solid #DBDBDB; border-left: 5px solid #1A1A1C; background-color: #F0F0F0;">Client Name</td>
<td style="color: #333333;   border-top: 1px solid #DBDBDB; border-right: 5px solid #1A1A1C; border-bottom: 1px solid #DBDBDB; border-left: 1px solid #DBDBDB;  background-color: #F0F0F0;">'.$ticketInfo['client_name'].'</td>
</tr>

<tr>
<td colspan="2">
'.$notes.'

<br /><br /><strong><em>To comment on this ticket, you can either replay directly to this email, or click the link below to view previous comments</em></strong><br />
<a href="'.$url .'"><em>Click Here To View This Ticket</em><a/><br /><br />
</td>
</tr>   

</table>
</body></html>

0 个答案:

没有答案