HELP: Sending Emails From Webform

V

VB Programmer

My company has it's own webserver, which is going to host our ASP.NET web
application. We want the website to be able to send out emails.

1. What do I need on the server so that it has the abillity to send out
emails? It is a Windows 2000 Professional SP3 server.
2. Any examples (code, etc...) on how to send out emails via an ASP.NET
webform?

Thanks!
 
R

Ruslan Shlain

Not too worry.
Its very easy.
First make syre you have SMPT server /Services running on your web server.

As far as code you can use any exemples in the books or online. see if this
will work for you

Public Function SendEmail() As Boolean

'For a Windows Forms Application, add a reference to


'System.Web.dll using [Project Add References]





Dim email As New MailMessage()





'The email address of the sender


email.From = "(e-mail address removed)"





'The email address of the recipient.


'Seperate multiple email adresses with a comma seperator


email.To = "(e-mail address removed)"





'The subject of the email


email.Subject = "UtilMailMessage001"





'The Priority attached and displayed for the email


email.Priority = MailPriority.High





'The format of the contents of the email


'The email format can either be MailFormat.Html or MailFormat.Text


'MailFormat.Html : Html Content


'MailFormat.Text : Text Message


email.BodyFormat = MailFormat.Html





'The contents of the email can be a HTML Formatted Message


email.Body = "<html><body><table><tr><td>A Star Is
Born</td></tr></table></body></html>"





'The name of the smtp server to use for sending emails


'SmtpMail.SmtpServer is commonly ignored in many applications


SmtpMail.SmtpServer = "Mail.NoSpamServer.com"





'Send the email and handle any error that occurs


Try


SmtpMail.Send(email)


Return True


Catch


Return False


End Try





End Function 'Send Email Synchronously With VB.NET, SmtpService,
MailMessage Class and System.Web.Mail Namespace
 
V

VB Programmer

Thanks. Does this service come with W2K professional? That is what my web
server is.

Ruslan Shlain said:
Not too worry.
Its very easy.
First make syre you have SMPT server /Services running on your web server.

As far as code you can use any exemples in the books or online. see if this
will work for you

Public Function SendEmail() As Boolean

'For a Windows Forms Application, add a reference to


'System.Web.dll using [Project Add References]





Dim email As New MailMessage()





'The email address of the sender


email.From = "(e-mail address removed)"





'The email address of the recipient.


'Seperate multiple email adresses with a comma seperator


email.To = "(e-mail address removed)"





'The subject of the email


email.Subject = "UtilMailMessage001"





'The Priority attached and displayed for the email


email.Priority = MailPriority.High





'The format of the contents of the email


'The email format can either be MailFormat.Html or MailFormat.Text


'MailFormat.Html : Html Content


'MailFormat.Text : Text Message


email.BodyFormat = MailFormat.Html





'The contents of the email can be a HTML Formatted Message


email.Body = "<html><body><table><tr><td>A Star Is
Born</td></tr></table></body></html>"





'The name of the smtp server to use for sending emails


'SmtpMail.SmtpServer is commonly ignored in many applications


SmtpMail.SmtpServer = "Mail.NoSpamServer.com"





'Send the email and handle any error that occurs


Try


SmtpMail.Send(email)


Return True


Catch


Return False


End Try





End Function 'Send Email Synchronously With VB.NET, SmtpService,
MailMessage Class and System.Web.Mail Namespace



VB Programmer said:
My company has it's own webserver, which is going to host our ASP.NET web
application. We want the website to be able to send out emails.

1. What do I need on the server so that it has the abillity to send out
emails? It is a Windows 2000 Professional SP3 server.
2. Any examples (code, etc...) on how to send out emails via an ASP.NET
webform?

Thanks!
 
R

Ruslan Shlain

Yes

VB Programmer said:
Thanks. Does this service come with W2K professional? That is what my web
server is.

Ruslan Shlain said:
Not too worry.
Its very easy.
First make syre you have SMPT server /Services running on your web server.

As far as code you can use any exemples in the books or online. see if this
will work for you

Public Function SendEmail() As Boolean

'For a Windows Forms Application, add a reference to


'System.Web.dll using [Project Add References]





Dim email As New MailMessage()





'The email address of the sender


email.From = "(e-mail address removed)"





'The email address of the recipient.


'Seperate multiple email adresses with a comma seperator


email.To = "(e-mail address removed)"





'The subject of the email


email.Subject = "UtilMailMessage001"





'The Priority attached and displayed for the email


email.Priority = MailPriority.High





'The format of the contents of the email


'The email format can either be MailFormat.Html or MailFormat.Text


'MailFormat.Html : Html Content


'MailFormat.Text : Text Message


email.BodyFormat = MailFormat.Html





'The contents of the email can be a HTML Formatted Message


email.Body = "<html><body><table><tr><td>A Star Is
Born</td></tr></table></body></html>"





'The name of the smtp server to use for sending emails


'SmtpMail.SmtpServer is commonly ignored in many applications


SmtpMail.SmtpServer = "Mail.NoSpamServer.com"





'Send the email and handle any error that occurs


Try


SmtpMail.Send(email)


Return True


Catch


Return False


End Try





End Function 'Send Email Synchronously With VB.NET, SmtpService,
MailMessage Class and System.Web.Mail Namespace



VB Programmer said:
My company has it's own webserver, which is going to host our ASP.NET web
application. We want the website to be able to send out emails.

1. What do I need on the server so that it has the abillity to send out
emails? It is a Windows 2000 Professional SP3 server.
2. Any examples (code, etc...) on how to send out emails via an ASP.NET
webform?

Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top