By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,319 Members | 2,115 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,319 IT Pros & Developers. It's quick & easy.

HELP: Sending Emails From Webform

P: n/a
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!
Nov 18 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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 = "fr**@microsoft.com"

'The email address of the recipient.
'Seperate multiple email adresses with a comma seperator
email.To = "to@microsoft.com"

'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" <gr*********@go-intech.com> wrote in message
news:#J**************@TK2MSFTNGP09.phx.gbl...
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!

Nov 18 '05 #2

P: n/a
Thanks. Does this service come with W2K professional? That is what my web
server is.

"Ruslan Shlain" <rs*****@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
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 = "fr**@microsoft.com"

'The email address of the recipient.
'Seperate multiple email adresses with a comma seperator
email.To = "to@microsoft.com"

'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" <gr*********@go-intech.com> wrote in message
news:#J**************@TK2MSFTNGP09.phx.gbl...
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!


Nov 18 '05 #3

P: n/a
Yes

"VB Programmer" <gr*********@go-intech.com> wrote in message
news:#D**************@TK2MSFTNGP09.phx.gbl...
Thanks. Does this service come with W2K professional? That is what my web
server is.

"Ruslan Shlain" <rs*****@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
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 = "fr**@microsoft.com"

'The email address of the recipient.
'Seperate multiple email adresses with a comma seperator
email.To = "to@microsoft.com"

'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" <gr*********@go-intech.com> wrote in message
news:#J**************@TK2MSFTNGP09.phx.gbl...
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!



Nov 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.