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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send an email with asp.net

Status
Not open for further replies.

Dan688

Programmer
Dec 29, 2003
128
0
0
GB
Afternoon,
What I'm looking to do is setup a web form in asp.net for people to fill in and send in to a email group within Outlook.

Following this a second part is allowing the user to attach a word document to the email.

Any ideas welcome.
 
Take a look at:


To add an attachment you would just add the lines:

Code:
            ' Add attachments
            'Dim objAttachment As New MailAttachment("MyFile.txt")
            'objMM.Attachments.Add(objAttachment)

----------------------------------------------------------------------

Need help finding an answer?

Try the search facilty ( or read FAQ222-2244 on how to get better results.
 
Code:
Dim str As New StringBuilder
Dim status As String

str.Append("There has been a task assigned to you.")
str.Append("Date: " & Date.Now.Date)
Dim email As New MailMessage
email.BodyFormat = MailFormat.Text
email.From = ConfigurationSettings.AppSettings("FromAddress")
email.To = "email@email.com"
email.Subject = "Task Reassignment"
email.Body = str.ToString
email.Attachments.Add(object)
Try
SmtpMail.SmtpServer = ConfigurationSettings.AppSettings("SmtpServer")
SmtpMail.Send(email)
Catch ex As Exception
 Dim catchMe As New Admin.CaughtError
 catchMe.showMeTheError(ex)
End Try
email = Nothing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top