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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
crystal boyPosted Mar 13, 2013, 11:33 AM
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
Vishal GilbilePosted Mar 12, 2013, 6:29 AM
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