2009-12-17 101 views
1

我的客戶想要的網頁,他們可以通過IE瀏覽器的郵件發送,但是當我做文件>通過電子郵件發送>頁它在網頁的頂部,一些隨機增加了一個隱藏的輸入字段字母在裏面。發送網頁

我被要求將其刪除...

我試過的EnableViewState = false,並從支持JavaScript的DOM移除它,甚至用CSS隱藏它,但它仍不斷顯示在電子郵件(不在瀏覽器頁面上雖然):(

我不知道你需要什麼幫助,所以我貼了這一切,在這裏是值編碼:

CS:

using System; 
using System.Collections.Generic; 
using System.Web; 
using System.Web.UI; 
using System.Web.UI.WebControls; 
using WorksUnit.Clydesdale.PropertyManager; 
using WorksUnit.Clydesdale.PropertyManager.BusinessObjects; 

namespace WorksUnit.Clydesdale.PropertyManager.Website.Summary 
{ 
    public partial class MaintenanceJobSheet : System.Web.UI.Page 
    { 
     private int _cachedPropertyId = 0; 
     private const string PROPERTYID_QUERY_STRING = "PropertyID"; 
     private int _propertyId 
     { 
      get 
      { 
       if (_cachedPropertyId == 0 && Request.QueryString[PROPERTYID_QUERY_STRING] != null) 
       { 
        int.TryParse(Request.QueryString[PROPERTYID_QUERY_STRING].ToString(), out _cachedPropertyId); 
       } 

       return _cachedPropertyId; 
      } 
      set { _cachedPropertyId = value; } 
     } 
     private int maintenanceId 
     { 
      get 
      { 
       if (!string.IsNullOrEmpty(Request.QueryString["maintenanceId"])) 
       { 
        return Convert.ToInt32(Request.QueryString["maintenanceId"]); 
       } 
       else 
       { 
        return 0; 
       } 
      } 
     } 
     protected void Page_Load(object sender, EventArgs e) 
     { 
      if (maintenanceId != 0) 
      { 
       BusinessObjects.Maintenance maintenance = BusinessObjects.Maintenance.Retrieve(maintenanceId); 
       LiteralJobNumber.Text = maintenance.JobNumber; 
       LiteralDescription.Text = maintenance.Description; 
       LiteralContractor.Text = maintenance.Contractor.Description; 
       if(maintenance.Date!=DateTime.MinValue) 
       { 
        LiteralDate.Text = maintenance.Date.ToShortDateString(); 
       } 
       if(maintenance.CompletionDate!=DateTime.MinValue) 
       { 
        LiteralCompletionDate.Text = maintenance.CompletionDate.ToShortDateString(); 
       } 
       if(maintenance.DateInvoiced!=DateTime.MinValue) 
       { 
        LiteralInvoicedDate.Text = maintenance.DateInvoiced.ToShortDateString(); 
       } 
       if(maintenance.DatePaid!=DateTime.MinValue) 
       { 
        LiteralDatePaid.Text =maintenance.DatePaid.ToShortDateString(); 
       } 
       LiteralChargeDetails.Text = maintenance.DetailsOfCharging; 
       LiteralUpdate.Text = maintenance.LatestSummary; 
      } 
     } 
    } 
} 

前端:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MaintenanceJobSheet.aspx.cs" EnableViewState="false" Inherits="WorksUnit.Clydesdale.PropertyManager.Website.Summary.MaintenanceJobSheet" %> 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server"> 
    <title>Clydesdale Property Solutions Work Request</title> 
    <link rel="stylesheet" type="text/css" media="screen" href="/css/screen.css" /> 
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script> 
</head> 
<body> 
    <form id="form1" runat="server"> 
    <div> 
     <span><b>Contractor:</b>&nbsp;&nbsp;</span><asp:Literal ID="LiteralContractor" runat="server" /> 
     <br /><br /> 
     <span>Please undertake the following:-</span> 
     <br /><br /> 
     <table width="600" cellpadding="3" cellspacing="0" border="1px"> 
     <tr> 
      <td valign="top" width="150">Job Number:</td>    
      <td><asp:Literal ID="LiteralJobNumber" runat="server" Text="N/A" /></td> 
     </tr> 
     <tr> 
      <td valign="top" width="150">Description:</td>    
      <td><asp:Literal ID="LiteralDescription" runat="server" /></td> 
     </tr> 
     <tr> 
      <td valign="top" width="150">Date:</td>    
      <td><asp:Literal ID="LiteralDate" runat="server" /></td> 
     </tr> 
     <tr> 
      <td valign="top" width="150">Completion Date:</td> 
      <td><asp:Literal ID="LiteralCompletionDate" runat="server" /></td> 
     </tr>   
     <tr> 
      <td valign="top" width="150">Invoiced Date:</td> 
      <td><asp:Literal ID="LiteralInvoicedDate" runat="server" /></td> 
     </tr> 
     <tr> 
      <td valign="top" width="150">Date Paid:</td> 
      <td><asp:Literal ID="LiteralDatePaid" runat="server" /></td> 
     </tr> 
     <tr> 
      <td valign="top" width="150">Details of Charging:</td> 
      <td><asp:Literal ID="LiteralChargeDetails" runat="server" /></td> 
     </tr> 
     <tr> 
      <td valign="top" width="150">Update:</td> 
      <td><asp:Literal ID="LiteralUpdate" runat="server" /></td> 
     </tr> 
     </table> 
     <br /><br /><br /> 
     <span>Thank You</span> 
     <br /><br /><br /> 
     Clydesdale Estates,<br /> 
     Tel:02380331234 <br /> 
     Fax:02380335522<br /> 
     Email: [email protected] 
    </div> 
    </form> 
</body> 
</html> 

而這正是顯示了當我查看源上的電子郵件:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 
<HTML> 
<HEAD> 
<TITLE>Clydesdale Property Solutions Work Request</TITLE> 
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type> 
<BASE href="http://localhost:4659/Summary/MaintenanceJobSheet.aspx"> 
<LINK rel=stylesheet type=text/css href="/css/screen.css" media=screen> 
<META name=GENERATOR content="MSHTML 8.00.6001.18854"> 
</HEAD> 
<BODY> 
<FORM id=form1 method=post name=form1 action=MaintenanceJobSheet.aspx> 
<!-- random input appears here (wrapped in a div) --><DIV> 
<INPUT id=__VIEWSTATE 
value=/wEPDwUJNzAyODg3NjY4ZGT+zJss/Xlbkhlxv8we8oRPUGNy9Q== type=hidden name=__VIEWSTATE> 
</DIV> <!-- and ends here --> 
<DIV><SPAN><B>Contractor:</B>&nbsp;&nbsp;</SPAN> <BR><BR><SPAN>Please undertake the following:-</SPAN> <BR><BR> 
<TABLE border=1 cellSpacing=0 cellPadding=3 width=600> 
<TD vAlign=top width=150><!-- more content goes here --></TD> 
</TR> 
</TABLE> 
</DIV> 
</FORM> 
</BODY> 
</HTML> 

任何幫助將不勝感激。

回答

0

我有一個類似的問題,我創造了我的僱主的HTML新聞信和所有的內部代碼(圖片,鏈接......)的變化,當我通過互聯網發爆器/ Outlook發送它。

我敢肯定,你的客戶(像我)希望此功能,以便他們可以使用Outlook來編輯電子郵件,並將它們發送到他們的Outlook聯繫人。似乎沒有太多方法可以解決這個問題。

只有兩個方法,我圍繞着這一迄今發現的。

  1. 您可以使用不同的電子郵件客戶端(如Mozilla的Thunderbird)。您可以將源代碼複製並粘貼到電子郵件的源代碼中併發送(但當您讓其他人複製並粘貼時,它並不真的覺得它是一個完全專業的項目)。

  2. 或者另一種方式是,你可以在其他語言中使用的庫創建您自己的電子郵件收發服務。比如PHP。

    當你通過PHP沒有什麼變化送的東西,你在其中電子郵件的它是從哪裏來的控制。這需要一些調整,這樣的電子郵件不會被丟棄垃圾郵件,但是我已經張貼下面如果大家感興趣的一些代碼。

如果任何人有一個更好的主意,或者更簡單的方式去了解這個請讓我的知道我會,如果有一個更簡單的方法很高興。
你應該幾乎可以說其擰緊,並保留原樣。

<?php 
//file_get_contents('./newsletter.html', true); // or use a file for the body 
//$body = file_get_contents('../newsletter/2010/1/newsletter.html', true); 
//define the receiver of the email 
$to = '[email protected]'; 
//define the subject of the email 
$subject = 'Test HTML email'; 
//create a boundary string. It must be unique 
//so we use the MD5 algorithm to generate a random hash 
$random_hash = md5(date('r', time())); 
//define the headers we want passed. Note that they are separated with \r\n 
$headers = "From: [email protected]\r\nReply-To: [email protected]"; 
//add boundary string and mime type specification 
$headers .= "\r\nContent-Type: multipart/alternative; boundary=\"PHP-alt-".$random_hash."\""; 
//define the body of the message. 
ob_start(); //Turn on output buffering 
?> 
--PHP-alt-<?php echo $random_hash; ?> 
Content-Type: text/plain; charset="iso-8859-1" 
Content-Transfer-Encoding: 7bit 

Hello World!!! 
This is simple text email message. 

--PHP-alt-<?php echo $random_hash; ?> 
Content-Type: text/html; charset="iso-8859-1" 
Content-Transfer-Encoding: 7bit 

<h2>Hello World!</h2> 
<p>This is something with <b>HTML</b> formatting.</p> 
<img src="http://****/test.png" width="600" height="123" alt="test pic for html email"> 

--PHP-alt-<?php echo $random_hash; ?>-- 
<? 
//copy current buffer contents into $message variable and delete current output buffer 
$message = ob_get_clean(); 
//send the email 
$mail_sent = @mail($to, $subject, $message, $headers); 
//if the message is sent successfully print "Mail sent". Otherwise print "Mail failed" 
echo $mail_sent ? "Mail sent" : "Mail failed"; 
?>