Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Dear

I have created one HTML Page. I send the mail using HTML Code.
Posted
Updated 5-Nov-18 3:46am
v2
Comments
TweakBird 31-Dec-10 1:53am    
I think question not properly asked. why you are pasting code in answer section. Please Re-Edit the question, ask properly. please use <pre> tag for code blocks.

Here is a form I used recently, it allows dropdowns to preselected addresses, it may prove helpful.

XML
<pre lang="xml"><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 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">Please use our contact form to make any enquiries.</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@fosbern.co.uk?subject=HomeQuery&body=">Sales</option>
            <option value="mailto:colin@fosbern.co.uk?subject=HomeQuery&body=">Contractor</option>
            <option value="mailto:pat@fosbern.co.uk?subject=HomeQuery&body=">Technical</option>
            <option value="mailto:enquiries@fosbern.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>


 
Share this answer
 
If you want to send email using html, you need to use the mailto: tag.
Some email client should be configured on your machine.

See here[^].
 
Share this answer
 
v2
Hello, you can see this link (http://answers.oreilly.com/topic/2349-creating-a-contact-form-aspnet-c/[^]) which explains how to develop a contact form based in ASP.NET (C#). In every cases you use HTML besides a language (Javascript, ASP.NET, etc.).

Best regards
Ángel Manuel
 
Share this answer
 
You can attempt this solution:
http://www.tek-tips.com/viewthread.cfm?qid=1003014&page=1[^]

It uses var outlookApp = new ActiveXObject("Outlook.Application"); to access outlook and control it from the browser, or you can try accessing MAPI directly.

Regards
Espen Harlinn
 
Share this answer
 
v2
using this code

using System.Net.Mail;
//creating mail message object
MailMessage mailMessage = new MailMessage();
mailMessage.From = new MailAddress("Put From mail address here");
mailMessage.To.Add(new MailAddress("Put To Email Address here"));
mailMessage.CC.Add(new MailAddress("Put CC Email Address here"));
mailMessage.Bcc.Add(new MailAddress("Put BCC Email Address here"));
mailMessage.Subject = "Put Email Subject here";
mailMessage.Body = "Put Email Body here ";
mailMessage.IsBodyHtml = true;//to send mail in html or not

SmtpClient smtpClient = new SmtpClient("Put smtp server host here", 25);//portno here
smtpClient.EnableSsl = false; //True or False depends on SSL Require or not
smtpClient.UseDefaultCredentials = true ; //true or false depends on you want to default credentials or not
Object mailState = mailMessage;
//this code adds event handler to notify that mail is sent or not
smtpClient.SendCompleted += new SendCompletedEventHandler(smtpClient_SendCompleted);
try
{
smtpClient.SendAsync(mailMessage, mailState);
}
catch (Exception ex)
{
Response.Write(ex.Message);
Response.Write(ex.StackTrace);
}
Following is a code for event handler

void smtpClient_SendCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
{
MailMessage mailMessage = e.UserState as MailMessage;
if (!e.Cancelled && e.Error != null)
{
Response.Write("Email sent successfully");
}
else
{
Response.Write(e.Error.Message);
Response.Write(e.Error.StackTrace);
}
}
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900