|
-
Jul 19th, 2006, 10:32 AM
#1
Thread Starter
New Member
How to log into Outlook account
Is there any way in which we can log into our Outlook account throgh VB and send a mail.
-
Jul 19th, 2006, 11:40 AM
#2
Re: How to log into Outlook account
Yes, add a reference to MS Outlook xx.0 Object Library and create an email. I have many many code examples on the forums already. Try a search by my user name and Outlook.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 27th, 2006, 09:11 AM
#3
Thread Starter
New Member
Re: How to log into Outlook account
I know how to send a mail through VB but it works only if Outlook is open and any user is logged on. I want to know if we can supply the userID and password through code and execute it. I was using the following code to send the mail
VB Code:
Private Sub Form_Load()
Dim app As Outlook.Application
Dim mail As Outlook.MailItem
Set app = CreateObject("Outlook.Application")
Set mail = app.CreateItem(olMailItem)
With mail
.Subject = "Hi This is a test mail"
.Body = "There is an error"
'.Attachments.Add "\\server\drive\folder\filename", olByValue, 1
.Send
End With
End Sub
Can anyone help me out.
Last edited by Hack; Jul 27th, 2006 at 10:47 AM.
Reason: Fixed [vbcode] [/vbcode] tags
-
Jul 27th, 2006, 12:49 PM
#4
Re: How to log into Outlook account
You can log on like so...
VB Code:
Option Explicit
Private Sub Form_Load()
Dim app As Outlook.Application
Dim mail As Outlook.MailItem
Set app = CreateObject("Outlook.Application")
app.GetNamespace("MAPI").Logon "Profile", "Password", "ShowDialog", "New Session"
Set mail = app.CreateItem(olMailItem)
With mail
.Subject = "Hi This is a test mail"
.Body = "There is an error"
'.Attachments.Add "\\server\drive\folder\filename", olByValue, 1
.Send
End With
End Sub
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|