Hi,
I want to send email from contact form with all details that user enters in form .
Can any one tell me how to do it?
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Vishal GilbileRank #268 · 9.4K reputationPosted Mar 12, 2013, 2:29 AM EDT
The following links may help you to solve your problem
http://www.c-sharpcorner.com/uploadfile/17e8f6/sending-automatic-mails-in-Asp-Net/
http://www.c-sharpcorner.com/uploadfile/17e8f6/sending-automatic-mail-through-Asp-Net/
With Regards,
Vishal Gilbile
crystal boy39 reputationPosted Mar 13, 2013, 7:33 AM EDT
Imports System.Net.Mail
Imports System.Net
Imports Outlook = Microsoft.Office.Interop.Outlook
Try
' Create the Outlook application.
Dim oApp As New Outlook.Application()
' Create a new mail item.
Dim oMsg As Outlook.MailItem = DirectCast(oApp.CreateItem(Outlook.OlItemType.olMailItem), Outlook.MailItem)
' Set HTMLBody.
'add the body of the email
oMsg.HTMLBody = "Hi Team,
Kindly Find the attachment and do the proceedings.
*** Please Donot reply to this mail ***
Thanks and Regards
Support "
'Add an attachment.
Dim sDisplayName As [String] = "MyAttachment"
Dim iPosition As Integer = CInt(oMsg.Body.Length) + 1
Dim iAttachType As Integer = CInt(Outlook.OlAttachmentType.olByValue)
'now attached the file
Dim oAttach As Outlook.Attachment = oMsg.Attachments.Add("C:\ss.xls", iAttachType, iPosition, sDisplayName)
'Subject line
oMsg.Subject = "Regarding Database Monitoring you have got mail"
' Add a recipient.
Dim oRecips As Outlook.Recipients = DirectCast(oMsg.Recipients, Outlook.Recipients)
' Change the recipient in the next line if necessary.
Dim oRecip As Outlook.Recipient = DirectCast(oRecips.Add("mailid 1"), Outlook.Recipient)
Dim oRecip1 As Outlook.Recipient = DirectCast(oRecips.Add("mailid 2"), Outlook.Recipient)
Dim oRecip2 As Outlook.Recipient = DirectCast(oRecips.Add("mailid 3"), Outlook.Recipient)
oRecip.Resolve()
oRecip1.Resolve()
oRecip2.Resolve()
' Send.
oMsg.Send()
' Clean up.
oRecip = Nothing
oRecip1 = Nothing
oRecip2 = Nothing
oRecips = Nothing
oMsg = Nothing
oApp = Nothing
'end of try block
Catch ex As Exception
End Try