Solved

VB.Net Hotmail/Windows Live

Posted on 2010-08-25
4
1,204 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

636 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