Solved

VB.Net Hotmail/Windows Live

Posted on 2010-08-25
4
1,189 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

751 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