|
-
Feb 21st, 2006, 07:39 AM
#1
Thread Starter
New Member
Using outlook express in vb.net2003
Hai,
Is there anyone who can tell me how to use outlook express in vb.net2003?
I would like that when i click on my mailbutton that outlook express opens. I would also that i can attach a selected picture from my paint program. I don't know how to do
Anyone who can help me?
Greetz
-
Feb 21st, 2006, 10:19 AM
#2
Re: Using outlook express in vb.net2003
The only way to do what you want is to start a process with the "mailto:' protocol. You can not automate or program Outlook Express since it doesnt expose any valid COM interfaces.
VB Code:
System.Diagnostics.Process.Start("mailto: [email protected]?subject=test&body=test&attach=" & Chr(34) & strFileToAttach & Chr(34) & ")
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 
-
Feb 21st, 2006, 11:59 AM
#3
Thread Starter
New Member
Re: Using outlook express in vb.net2003
How do I get the picture as attachment in the mail? It always ask after a string. The image i will send is in a picturebox
-
Feb 21st, 2006, 12:02 PM
#4
Re: Using outlook express in vb.net2003
You could also look into System.Web.Mail. It's pretty straight forward and allows attachments.
VB Code:
Dim mail As New System.Web.Mail.MailMessage
Dim smtp As System.Web.Mail.SmtpMail
mail.Priority = Web.Mail.MailPriority.Normal
mail.Subject = "subject"
mail.Body = "body"
Dim att As New System.Web.Mail.MailAttachment("C:\test2.bmp")
mail.Attachments.Add(att)
smtp.Send(mail)
Last edited by sevenhalo; Feb 21st, 2006 at 12:22 PM.
-
Feb 21st, 2006, 12:19 PM
#5
Thread Starter
New Member
Re: Using outlook express in vb.net2003
Hello,
On your code it gives errors. It says it don't recognize System.Web.Mail.MailMessage :s
-
Feb 21st, 2006, 12:21 PM
#6
Re: Using outlook express in vb.net2003
You have to add a reference to System.Web.
Robdog has a better solution if you can make it work. It will use your system's default settings instead of tring to go around them.
-
Feb 21st, 2006, 12:26 PM
#7
Re: Using outlook express in vb.net2003
I just wanted to note that I remember reading that attaching a file is not part of the official MAILTO: syntax... so while it may work if the specific email client supports it, its not guaranteed that it will work with every mail client.
-
Feb 21st, 2006, 12:30 PM
#8
Re: Using outlook express in vb.net2003
I should have also asked, are you using an SMTP engine for your mail server? Or is it POP3 or http? This is only going to work with smtp, http and pop3 have their own mechanics.
-
Feb 21st, 2006, 12:39 PM
#9
Re: Using outlook express in vb.net2003
Yes, thats right klienma. You also need to parse out the special characters and replace them with their web hex equilivalent.
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 
-
Feb 21st, 2006, 01:03 PM
#10
Thread Starter
New Member
Re: Using outlook express in vb.net2003
I'm using an SMTP server. So when i use this code System.Diagnostics.Process.Start("mailto:[email protected]?subject=test&body=test&attach=" & Chr(34) & strFileToAttach & Chr(34) & ") Can i attach something from my picturebox then?
-
Feb 21st, 2006, 01:17 PM
#11
Re: Using outlook express in vb.net2003
Yes, but the filepath needs to be in the variable - strFileToAttach and be formatted so the path chars are correctly converted to hex.
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 
-
Feb 27th, 2006, 12:42 PM
#12
Thread Starter
New Member
Re: Using outlook express in vb.net2003
 Originally Posted by RobDog888
Yes, but the filepath needs to be in the variable - strFileToAttach and be formatted so the path chars are correctly converted to hex.
somthing like this: Dim StrAttachment As String = CStr(PictureBox1.Image) or.... But this doesn't work
-
Feb 27th, 2006, 01:03 PM
#13
Re: Using outlook express in vb.net2003
Nope, it wont because your trying to attach a binary image instead of a file on your hard drive and replace the invalid chars with their Hex equilivalent.
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 
-
Feb 27th, 2006, 01:54 PM
#14
Thread Starter
New Member
Re: Using outlook express in vb.net2003
So can you give an example please, my english isn't very well.
-
Feb 27th, 2006, 02:02 PM
#15
Re: Using outlook express in vb.net2003
You need to save the image file to your disk. Then use that file path to pass into the attachment argument with the bad chars converted to hex.
VB Code:
C:\Some path\some file.txt
'Should be having the :\ and spaces as hex
%20 = space
'not sure what the other two would be.
'This is partially converted.
C:\Some%20path\some%20file.txt
Last edited by RobDog888; Mar 1st, 2006 at 03:19 AM.
Reason: type-o
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 
-
Mar 1st, 2006, 02:16 AM
#16
Thread Starter
New Member
Re: Using outlook express in vb.net2003
Thx, but is there also a posibility to get a picture from a database and then set them in the mail?
-
Mar 1st, 2006, 02:30 AM
#17
Re: Using outlook express in vb.net2003
I think you might want to edit post #15 Rob.
-
Mar 1st, 2006, 03:20 AM
#18
Re: Using outlook express in vb.net2003
Done.
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
|