Handlesendemail.aspx logic
protected void Page_Load (Object Sender,eventargs e)
{
foreach (var item in Request.Form.Keys)
{
if (item. ToString (). Startswidth ("Txtmail"))
{
String Mail=request.form[item. ToString ()];
Setting up SMTP servers and ports
SmtpClient smtpclient=new smtpclient ("[Email protected]", 25);
Set the user name and password to log on to the SMTP service when sending mail
SmtpClient. Credentials=new networkcredentail ("User name", "password");
MailMessage mailmessage=new MailMessage ();
Set Message subject
mailmessage.subject= "Theme";
mailmessage.body= "content";//Content
Mailmessage.form=new mailaddress ("Sender's email address");//Sender Address
MAILMESSAGE.TO.ADD (email);//Recipient
MAILMESSAGE.CC.ADD ("cc person e-mail address");//Set CC person address
Attachment attachfile=new Attachment (@ "attachment absolute path");//Accessories
MAILMESSAGE.ATTACHMENTS.ADD (Attachfile);
Smtpclient.send (MailMessage);//Execute Send command
}
}
}
Sending mail (following the SMTP protocol is a Simple mail-sending protocol)