需要在邮件中发送XML格式



我正在尝试发送邮件。因此,当有人收到邮件时,它将以适当的格式看到。

Web服务代码

  public Thankyou()
    {
        //Uncomment the following line if using designed components 
        //InitializeComponent(); 
        MailMessage o = new MailMessage("esh_p07@hotmail.com", "esh07@gmail.com", "Event Inquiry", @"< html >
< head >< title >[#text:@@hotelname#] Event Inquiry Form</title></head>
< body >
< h1 style = ""font - family:Verdana, Arial, Helvetica, sans - serif; font - weight:normal; font - size:14px; "" > You have received an email via the < b >[Culver Hotel </ b > Event Inquiry form.</ h1 >
          < h2 style = ""font - family:Verdana, Arial, Helvetica, sans - serif; font - weight:normal; font - size:12px; "" >
                    < b > From: </ b >[#text:contact_name#] <a href=""mailto:[#text:contact_email#]"" >[#text:contact_email#]</a><br>
< b > Phone: </ b > [#text:contact_phone#]<br>
< b > Requested Date: </ b > [#text:rfp_requestmonth#] [#text:rfp_requestdate#],[#text:rfp_requestyear#]<br>
< b > Requested Time: </ b > [#text:requested_time#]<br>
< b > Number of Guests: </ b > [#text:number_guests#]<br>
< b > Comments: </ b >< br > [#text:contact_comments#]
</ h2 >
                      </ body >
                      </ html >");
        NetworkCredential netCred = new NetworkCredential("user@example.com", "pAssw0rd");
        SmtpClient smtpobj = new SmtpClient("wm.ebservices.com", 38);
        smtpobj.EnableSsl = false;
        smtpobj.Credentials = netCred;
        smtpobj.Send(o);

    }

这是以XML格式存储的车身格式,我希望,当有人接收邮件时,它将以适当的格式看到,我使用html标签

XML代码

<html>
<head><title>[#text:@@hotelname#] Event Inquiry Form</title></head>
<body>
<h1 style="font-family:Verdana, Arial, Helvetica, sans-serif; font-weight:normal; font-size:14px;">You have received an email via the <b>[Culver Hotel</b> Event Inquiry form.</h1>
<h2 style="font-family:Verdana, Arial, Helvetica, sans-serif; font-weight:normal; font-size:12px;">
<b>From: </b>[#text:contact_name#] <a href="mailto:[#text:contact_email#]" >[#text:contact_email#]</a><br>
<b>Phone: </b> [#text:contact_phone#]<br>
<b>Requested Date: </b> [#text:rfp_requestmonth#] [#text:rfp_requestdate#],[#text:rfp_requestyear#]<br>
<b>Requested Time: </b> [#text:requested_time#]<br>
<b>Number of Guests: </b> [#text:number_guests#]<br>
<b>Comments: </b><br> [#text:contact_comments#]
</h2>
</body>
</html>

如果您需要使用Web-Services与提供的数据创建XML。您需要使用SOAP绑定RPC或文档创建接口。然后添加接口的实现。确保使用 @webserive @soapbinding 注释添加并渲染Java类。比,您的实现类应覆盖将以下数据添加为其他类或不可分割变量的对象的方法。:

<b>From: </b>[#text:contact_name#] <a href="mailto:[#text:contact_email#]" >[#text:contact_email#]</a><br>
<b>Phone: </b> [#text:contact_phone#]<br>
<b>Requested Date: </b> [#text:rfp_requestmonth#] [#text:rfp_requestdate#],[#text:rfp_requestyear#]<br>
<b>Requested Time: </b> [#text:requested_time#]<br>
<b>Number of Guests: </b> [#text:number_guests#]<br>
<b>Comments: </b><br> [#text:contact_comments#]

之后,您需要创建发布类并发布您的Weberice。点击您将在发布类中提及的URL,您将获得XML格式。

然后,您可以从URL获取XML文件,并像您一样邮寄。欢呼!!!

相关内容

  • 没有找到相关文章