发送表单到电子邮件WebMatri

发送表单到电子邮件WebMatri

本文介绍了发送表单到电子邮件WebMatrix中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个关于电子邮件的问题,我想发整个联络表格到电子邮件,并在本教程中的它拥有几乎一切,除了这条线在code

I have a question regarding emails, i want to send the whole contact form to email, and in this tutorial http://www.asp.net/web-pages/tutorials/email-and-search/11-adding-email-to-your-web-site it has almost everything except this line in code

// Send email
WebMail.Send(to: customerEmail,
    subject: "Help request from - " + customerName,
    body: customerRequest

);

}

我不明白如何编辑它,现在的是它是工作,但只送我customerRequest的电子邮件,因为现在有更多的细节一种形式,它只是发送customerRequest部分没有电子邮件,电话号码,物品等类,所以恳请协助如何通过这种发送整个表格或其他列。
谢谢

i do not understand how to edit it,now the thing is it is working but only sending me customerRequest in email because now there is a form with more details and it is only sending customerRequest part not email , number, items and other categories, so kindly assist how to send the whole form or other columns through this.Thanks

推荐答案

customerRequest 变量可以包含你想要它包含任何字符串。在本教程中,将其重新presents的customerRequest表单字段的值。您可以添加其他领域的形式和使用他们的价值观建立起来的电子邮件的正文。例如,您可以添加部分号码字段:

The customerRequest variable can contain any string you want it to contain. In the tutorial, it represents the value of the customerRequest form field. You can add other fields to the form and use their values to build up the body of the email. For example, you can add a partNumber field:


    
        你的名字:
        
    

Your name:

<div>
    Your email address:
    <input type="text" name="customerEmail" />
</div>
<div>
    Part Number:
    <input type="text" name="partNumber" />
</div>

<div>
    Details about your problem: <br />
    <textarea name="customerRequest" cols="45" rows="4"></textarea>
</div>

<div>
    <input type="submit" value="Submit" />
</div>

而在服务器端code,添加机体:

And in the server-side code, add that to the body:

@{
    var customerName = Request["customerName"];
    var customerEmail = Request["customerEmail"];
    var customerRequest = Request["customerRequest"];
    var partNumber = Request["partNumber"];
    var errorMessage = "";
    var debuggingFlag = false;
    //etc
}

这是你怎么串连值:

WebMail.Send(to: customerEmail,
            subject: "Help request from - " + customerName,
            body: "Part Number: " + partNumber + "\n\n" + customerRequest
        );

这篇关于发送表单到电子邮件WebMatrix中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 18:31