Solved

VB.Net Hotmail/Windows Live

Posted on 2010-08-25
4
1,178 Views
Last Modified: 2013-11-27
I have a VB.Net Application that needs to be able to send emails using a Hotmail/Windows Live Account. From what i have researched, I found that I need to use these settings:
     
 Hotmail Incoming Mail Server (POP3) - pop3.live.com (logon using Secure Password Authentification - SPA, mail server port: 995)

 Hotmail Outgoing Mail Server (SMTP) - smtp.live.com (SSL enabled, port 25)

Now how would I be able to use that to send a simple, text only email from vb.net?
0
Comment
Question by:XGenwareS
  • 2
  • 2
4 Comments
 
LVL 38

Expert Comment

by:Tom Beck
ID: 33527120
You do not say if it's a web application or windows, but I will assume web.
'code to send email

Private Sub SendInquiryByEmail()
        Try
            Dim mm As New System.Net.Mail.MailMessage(System.Configuration.ConfigurationManager.AppSettings("sender"), System.Configuration.ConfigurationManager.AppSettings("primeRecipient"))
            If Not System.Configuration.ConfigurationManager.AppSettings("ccRecipient") Is Nothing Then
                mm.CC.Add(System.Configuration.ConfigurationManager.AppSettings("ccRecipient"))
            End If
            If Not System.Configuration.ConfigurationManager.AppSettings("ccRecipient") Is Nothing Then
                mm.Bcc.Add(System.Configuration.ConfigurationManager.AppSettings("bccRecipient"))
            End If
            mm.Subject = "Subject here"
            mm.Body = "Message body here."
            mm.IsBodyHtml = False  'Plain text message
            Dim smtp As New SmtpClient
            smtp.Send(mm)
        Catch ex As Exception
            Me.errorMsg.Value = ex.ToString()
        End Try
    End Sub

'web.config settings

<system.net>
		<mailSettings>
			<smtp>
				<network
					 host="smtp.live.com"
					 port="25"
					 userName="username"
					 password="password" />
			</smtp>
		</mailSettings>
	</system.net>

<appSettings>
		<add key="primeRecipient" value="prime@recipient.com"/>
		<add key="ccRecipient" value="copyTo@recipient.com"/>
		<add key="bccRecipient" value="blindCopyTo@recipient.com"/>
		<add key="sender" value="me@sender.com"/>
	</appSettings>

Open in new window

0
 

Author Comment

by:XGenwareS
ID: 33527124
Sorry for that specifying. Its a windows app.
0
 
LVL 38

Accepted Solution

by:
Tom Beck earned 500 total points
ID: 33527197
Very similar.
Private Sub SendByEmail()
        Try
            Dim mm As New System.Net.Mail.MailMessage("sender@anywhere.com", "recipient@anywhere.com")
            mm.Subject = "Subject here"
            mm.Body = "Message body here."
            mm.IsBodyHtml = False
            Dim smtp As New System.Net.Mail.SmtpClient("smtp.live.com", 25)
            smtp.Send(mm)
        Catch ex As Exception
            Console.Write(ex.ToString())
        End Try
    End Sub

Open in new window

0
 

Author Comment

by:XGenwareS
ID: 33527217
Thanks works great!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Very Large data in MYSQL 7 73
FInd Image Control Gridview 3 22
VS 2017 18 53
Data organization issue 7 16
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question