Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

what component do I need to send email using asp.net

Status
Not open for further replies.

taree

Technical User
May 31, 2008
316
US
what component do I need to send email with asp.net. as you can see they use smtpsvg.mail for asp.net and I am wondering if I need this kind of componet to work with asp.net. please help. thank you

Code:
<%
Option Explicit

Dim Mailer
Dim Message
Dim Selection

If Trim(Request.Form("email")) <> "" Then

	Selection = Trim(Request.Form("buttonpushed"))

	Set Mailer = CreateObject("SMTPsvg.Mailer")

	If Selection = "Subscribe" Then
		Mailer.FromName = Request.Form("subscriberinfo")
		Message = "SUBSCRIBE  " & Request.Form("subscriberinfo") & VbCrLf
		Mailer.Subject = "Subscribe"
	ElseIf Selection = "Unsubscribe" Then
		Mailer.FromName = "mrl2ksweb"
		Message = "SIGNOFF" & VbCrLf
		Mailer.Subject = "Unsubscribe"
	End If

	Mailer.RemoteHost = "mail"
	Mailer.FromAddress= Request.Form("email")
	Mailer.AddRecipient "SEASONAL-LOAD-LIMITS-L", "listserv@xxx.xxxxx.xx.xx"
	Mailer.BodyText   = Message
	Mailer.SendMail

	Set Mailer = Nothing

%>
 
one issue though; looks like you are using COM objects, not the .net typed objects.
Code:
var message = new MailMessage
{
   from = ...,
   subject = ...,
   body = ...,
   other properties
};
new SmtpClient("server name", port).Send(message);
you can even configure some of the mail settings in the config file. see for more information

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
 
Thank you guys for the help. I think I am on the right track my only quetion is how do you convert this to asp.net
I am trying to use a listserv for customer to subscribe. I want to pass the name and domain name.

Mailer.AddRecipient "SEASONAL-LOAD-LIMITS-L", "listserv@xxx.xxxxx.xx.xx
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top