如何以HTML格式发送电子邮件
问题描述:
请帮助我.
操作说明:我"一词包含两个字母,而不是102.其中只有一个是元音.拼写听起来像是在抱怨,会让您看起来像个孩子-OriginalGriff [/edit]
Plz help me.
[edit]Note to the OP: the word "Me" contains two letters, not 102. Only one of these should be a vowel. Spelling words to sound like you are whining makes you appear to be a child - OriginalGriff[/edit]
答
从后面的代码中完成:有一个通用方法此处:使用C#发送带有或不带有C#的电子邮件附件:通用例程. [ ^ ]
下次,(除了学习拼写简单的单词)尝试首先使用Google.
Do it from the code behind: there is a generic method here: Sending an Email in C# with or without attachments: generic routine.[^]
Next time, (apart from learning to spell simple words) try to use Google first.
这是我使用的一种形式...
适应自己的需求.
Here is a form I use...
Adapt to your own needs.
<form action="../" enctype="text/plain">
<p style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px">
<input name="customername" size="60"
style="background-color: #FFFFCC; text-align: left;" type="text"
value="Name" tabindex="1"/>
<input name="customernumber" size="60"
style="background-color: #FFFFCC; text-align: left; width: 202px; margin-left: 42px;"
type="text" value="Tel No." tabindex="2" />
<input visible="false" name="space" size="0" style="width:0px;" value="%0A" tabindex="0" />
</p>
<p style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; height: 12px; width: 655px;"> </p>
<p style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"> </p>
<p style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px">Type of enquiry?</p>
<p style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px">
<select id="SelectContactType" name="sendEmailTo" onchange="setAction"
tabindex="3">
<option value="mailto:sales@ACompany.co.uk?subject=HomeQuery&body=">Sales</option>
<option value="mailto:colin@ACompany.co.uk?subject=HomeQuery&body=">Contractor</option>
<option value="mailto:pat@ACompany.co.uk?subject=HomeQuery&body=">Technical</option>
<option value="mailto:enquiries@ACompany.co.uk?subject=HomeQuery&body=">Other</option>
</select>
</p>
<p style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px"> </p>
<p style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px">Your Question...</p>
<p style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; height: 62px;">
<textarea cols="10" rows="3" id="TextArea1" name="textarea" tabindex="4"
style="overflow: visible; width: 507px;"></textarea>
</p>
<p style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; height: 9px;"> </p>
<p style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; height: 9px;"> </p>
<p style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; height: 9px;"> </p>
<p style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px">Finally, Your Email Address...</p>
<p style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px">
<input name="customeremailaddress" size="60"
style="background-color: #FFFFCC" type="text" tabindex="5" />
<input
type="button"
value="Submit"
onclick="location.href=this.form.sendEmailTo.options[sendEmailTo.selectedIndex].value + this.form.customername.value + this.form.space.value + this.form.customernumber.value + this.form.space.value + this.form.textarea.value + this.form.space.value + this.form.customeremailaddress.value"
tabindex="5"/>
</p>
<p style="text-align:center">
Press the Submit Button and we will contact you shortly with details, prices
etc
</p>
</form>
您不能直接从HTML表单发送邮件.您可以通过这样在客户端计算机(Ex.Outlook)上设置的默认邮件提供程序发送邮件,
You cannot send mail directly from HTML form. You can send the mail through default mail provider set up on the client machine(Ex.Outlook) like this,
<a href="mailto:name@xxx.com">name@xxx.com</a>
因此,当您单击邮件ID时,它将直接打开Outlook.
或
您可以使用.Net技术并使用下面的链接.
http://www.developer.com/net/asp/article.php/3096831/使用-ASPNET-To-Send-Email.htm [
So, when you click the mail id it will directly open Outlook.
Or
You you can use .Net technology and use the below link.
http://www.developer.com/net/asp/article.php/3096831/Using-ASPNET-To-Send-Email.htm[^]