Sending Email In Asp Dot Net

  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Sending Email In Asp Dot Net as PDF for free.

More details

  • Words: 176
  • Pages: 1
// this class sends email from an asp.net website. // edited by david stern, april 29, 2007. // for more information, visit http://www.davidstern.co.il // notice the added namespaces system.collections and system.net.mail. using using using using using using using using using using using

system; system.data; system.configuration; system.web; system.web.security; system.web.ui; system.web.ui.webcontrols; system.web.ui.webcontrols.webparts; system.web.ui.htmlcontrols; system.collections; system.net.mail;

public class sendingmail { mailmessage mlms = new mailmessage(); smtpclient smtp = new smtpclient(); // set the from email address, message subject and message body from the gui to the following fields: public string fromaddress; public string subjecttext; public string bodytext; // this arraylist contains multiple email addresses the email will be sent to. arraylist toaddresses = new arraylist(); // this method adds addresses to the above arraylist. call it from the gui. public void addaddress(string address) { toaddresses.add(address); } // this method sends the mail. public void send() { mlms.from = new mailaddress(fromaddress); foreach (string address in toaddresses) { mlms.to.add(address); } mlms.subject = subjecttext; mlms.isbodyhtml = true; mlms.body = bodytext;

} }

smtp.host = "localhost"; smtp.port = 25; smtp.deliverymethod = smtpdeliverymethod.pickupdirectoryfromiis; smtp.send(mlms);

Related Documents

Asp Dot Net
November 2019 10
Asp Dot Net Tutorial
July 2020 3
Dot Net
December 2019 31
Dot Net
November 2019 27
Dot Net
May 2020 23