General discussion

Locked

sending email using .Net Classes

By ongbling ·
hi,Realli need help from expert out here..I have the following code which retrieve email address from the text box and send the repective attachment to the email address from the textbox..:<%@ Page Language="C#" %>
<%@ Import Namespace="System.Web.Mail" %>
<script runat="server">

void btnSubmit_Click(Object sender, EventArgs e) {

MailMessage objEmail = new MailMessage();
objEmail.To = txtTo.Text;
objEmail.From = txtFrom.Text;
objEmail.Cc = txtCc.Text;
objEmail.Subject = "Test Email from the Article Working with Email using ASP.NET - Part 1";
objEmail.Body = txtName.Text + ", " +txtComments.Text;
objEmail.Priority = MailPriority.High;
objEmail.BodyFormat = MailFormat.Html;

// Make sure you have appropriate replying permissions from your local system
//SmtpMail.SmtpServer = "localhost";

try{
SmtpMail.Send(objEmail);
Response.Write("Your Email has been sent sucessfully - Thank You");
}
catch (Exception exc){
Response.Write("Send failure: " + exc.ToString());
}
}
</script>


i like to ask wat is the correct syntax if i want to retrieve the email address from the dropdownlist instead of typing on the textbox....what is the correct syntax to use instead of using txtto.text....


Thanks and Regards

This conversation is currently closed to new comments.

0 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Back to Web Development Forum
0 total posts (Page 1 of 1)  

Related Discussions

Related Forums