How To Send Email Using Microsoft Outlook Using VB.Net

logo حضرت خواجہ سیدنا معین الدین حسن چشتی سنجاری اجمیری رحمۃ اللہ علیہ logo
  • HOME
  • BLOGS
    • ASP.Net C#.Net JavaScript ADO.Net Excel AJAX VB.Net SQL Server GridView Issues and Exceptions Silverlight Rich Text Editor jQuery DataList Snippets XML New Features .Net 4.0 TreeView AJAX Control Toolkit jQuery Plugins Third Party Controls ASP.Net Validators WCF Repeater Regular Expressions Yahoo API iTextSharp FaceBook Charts ListView Tweeter Google CSS SMS DotNetZip Crystal Reports Entity Framework HyperLink RDLC Report SqlDataSource Menu YouTube Twitter HTML XmlDataSource ListBox Tips DataGridView Cryptography Windows Forms LinkedIn WebUserControl RSS Feeds HTML5 Sitemap IIS LINQ DataPager URL Routing SqlBulkCopy OCR ASP.Net 4.5 Master Pages MySQL CSV Stored Procedures JSON Web Services Bootstrap Windows Service DataTable App.Config Visual Studio RadioButton CheckBox Generic Handler DropDownList FileUpload RadioButtonList CheckBoxList Flash HtmlEditorExtender Div Table AngularJS DataReader DataSet Console Applications FTP DetailsView Password TextBox Enum ComboBox Sponsored SqlDataAdapter OpenXml ClosedXml SiteMapPath Arrays FormView
  • FORUMS
    • Questions
    • Ask Question
  • VIDEOS
  • SEARCH
  • INTERVIEW
    • Interview Questions
  • COMMUNITY
    • Users
  • CONTACT
  • Click to Login.
Search Ask Question How to send Email using Microsoft Outlook using VB.Net Nithin Nithin
  • SOLVED CLOSED ACTIVE ANSWERED
  • User: Nithin
  • Posted: on May 21, 2014 07:05 AM
  • Forum: ASP.Net Thirdparty controls
  • Replies: 5
  • Views: 45222

Hi,

Kindly help me out from this issue pls.

i want to send a Email through outlook using vb.net

Explain me step-by-step Coding pls.

its Little Bit Urgent.........

Thanks

Nithin

Download FREE API for Word, Excel and PDF in ASP.Net Azim Azim 0 1
  • Reply
  • ANSWER
  • User: Azim
  • Replied: on May 21, 2014 07:08 AM
  • Report

Refer these links

http://www.codeproject.com/Tips/165548/C-Code-snippet-to-send-an-Email-with-attachment-fr

VB code from the above link

Public Sub sendEMailThroughOUTLOOK() 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 = "Hello, Jawed your message body will go here!!" '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:\\fileName.jpg", iAttachType, iPosition, sDisplayName) 'Subject line oMsg.Subject = "Your Subject will go here." ' 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("[email protected]"), Outlook.Recipient) oRecip.Resolve() ' Send. oMsg.Send() ' Clean up. oRecip = Nothing oRecips = Nothing oMsg = Nothing oApp = Nothing 'end of try block Catch ex As Exception End Try 'end of catch End Sub

You can refer this link aslo.

http://www.codeproject.com/Articles/14045/Sending-Emails-using-NET-Part-II

Nithin Nithin 0 2
  • Reply
  • ANSWER
  • User: Nithin
  • Replied: on May 21, 2014 11:05 PM
  • Report

Hi Azim,

Am Happy with your code

Thanks a lot for your answer

i have some Queries regarding this code

1.for C# we are using port no.587 for vb.net we are not using any port numbers?

2.In this code the attached file will be a .jpg fromat but i want it should be accept all formats (.doc,.txt,etc....)?

Can you please answers my questions that will be more helpfull for me

and make me understandable

Thanks

Nithin

Azim Azim 0 3
  • Reply
  • ANSWER
  • User: Azim
  • Replied: on May 21, 2014 11:15 PM
  • Report
  1. In outlook there is no any need of port number.
  2. http://msdn.microsoft.com/en-us/library/ms268870.aspx
Nithin Nithin 0 4
  • Reply
  • ANSWER
  • User: Nithin
  • Replied: on May 21, 2014 11:21 PM
  • Report

Hi Azim,

thanks for your quick reply

Azim we have to import dll (Microsoft.Office.Interop.Outlook.dll)

and i have imported that from microsoft and written the code which u referd in codeproject(http://www.codeproject.com/Articles/14045/Sending-Emails-using-NET-Part-II) but its not working

Can you please check and tell me .its little bit urgent pls.

ManyThanks

Nithin

Nithin Nithin 0 5
  • Reply
  • ANSWER
  • User: Nithin
  • Replied: on May 22, 2014 12:12 AM
  • Report

Hi,

Can you plz check and let me know the code for sending Email through Outlook express using vb.net

its urgent Azim

Thanks

Nithin

I agree, here is the link: https://www.e-iceblue.com/Introduce/spire-office-for-net-free.html Ask Question Image

Company

  • About us
  • Contact us

Explore

  • Ask question
  • FAQs
  • Privacy policy

Follow us

  • Facebook
  • Instagram
  • YouTube
  • Twitter

Contact Us

  • Email: [email protected]
  • Address: ASPSNIPPETS PRIVATE LIMITED G-110, SHAGUN ARCADE, MALAD (EAST), MUMBAI, MAHARASHTRA, INDIA 400097.

© COPYRIGHT 2025 ASPSnippets.com ALL RIGHTS RESERVED.

Disclaimer This site makes use of Cookies. Please refer Privacy Policy for more details. Allow Reject

Từ khóa » Visual Basic Send Email Outlook