|
-
Feb 1st, 2005, 07:27 AM
#1
Thread Starter
Hyperactive Member
Sending e-mails from Access using Outlook [resolved]
Hi this is a problem which I'm realy stuck on. For a bit of background we use Exchange 2003 as are mailserver and have outlook 2000 clients.
I have an e-mailer program which takes an e-mail it recives and forward it out again. The problem is we have a client complaing saying he only wants the e-mail we send him to be in plain text. If I send the program straight from Outlook it's fine, but for some reson when I use the below code to send an e-mail it's sent as both plain text and HTML, anyone now how to change this.
VB Code:
Private Function sendemail(todest As String, subject As String, body As String) As Boolean
On Error GoTo sendwarning:
Dim fnam As String
Dim loopcounter As Integer
loopcounter = 0
Set objMailitem = objApp.CreateItem(olMailItem)
If addatt Then
Set myatts = myitem.Attachments
If myatts.Count > 0 Then
Set myatts = myitem.Attachments
Set objattachments = objMailitem.Attachments
Do While loopcounter < myatts.Count
loopcounter = loopcounter + 1
Set myatt = myatts(loopcounter)
fnam = myatt.FileName
If Mid(fnam, 1, 4) = "Page" Then
fnam = Mid(fnam, 1, 11)
End If
myatt.SaveAsFile fnam
objattachments.Add (fnam)
Loop
Else
Set myatt = Nothing
End If
End If
objMailitem.To = todest
objMailitem.subject = subject
objMailitem.body = body
objMailitem.Send
sendemail = True
Exit Function
sendwarning:
sendemail = False
End Function
Last edited by Oliver1; Feb 1st, 2005 at 10:50 AM.
-
Feb 1st, 2005, 10:50 AM
#2
Re: Sending e-mails from Access using Outlook
Nobody knows what software they want until after you've delivered what they originally asked for.
Don't solve problems which don't exist.
"If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)
2 idiots don't make a genius.
-
Feb 1st, 2005, 10:54 AM
#3
Thread Starter
Hyperactive Member
Re: Sending e-mails from Access using Outlook [resolved]
Thanks, is annoying when you can't figure something out. Should have done a search first (bad me) but didn't think it would be the kind of problm anyone else would have.
Thanks again
-
Feb 1st, 2005, 10:55 AM
#4
Re: Sending e-mails from Access using Outlook [resolved]
No, it's not your fault. The Office ActiveX EXE objects are extremely poorly documented. You have to dig hard and long to get any info on the internals of these objects.
Nobody knows what software they want until after you've delivered what they originally asked for.
Don't solve problems which don't exist.
"If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)
2 idiots don't make a genius.
-
Feb 1st, 2005, 11:51 AM
#5
Re: Sending e-mails from Access using Outlook [resolved]
Dave, instead of setting it to 1, wouldnt it be easier reading to set it to the const. - olFormatHTML ?
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 1st, 2005, 11:52 AM
#6
Re: Sending e-mails from Access using Outlook [resolved]
 Originally Posted by RobDog888
Dave, instead of setting it to 1, wouldnt it be easier reading to set it to the const. - olFormatHTML ?
Totally. But sometimes you don't get constants in VB, and I couldn't tell by the MSDN documentation so I just played it safe. Definately use constants if they are available to you.
Nobody knows what software they want until after you've delivered what they originally asked for.
Don't solve problems which don't exist.
"If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)
2 idiots don't make a genius.
-
Feb 1st, 2005, 12:08 PM
#7
Re: Sending e-mails from Access using Outlook [resolved]
Thats what I thought. You dont get the const.'s when you are using
VBScript or are using late binding
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 1st, 2005, 12:12 PM
#8
Re: Sending e-mails from Access using Outlook [resolved]
P.S. the MSDN docs say to use CdoBodyFormatText. I think its different in the VB IDE.
Nobody knows what software they want until after you've delivered what they originally asked for.
Don't solve problems which don't exist.
"If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)
2 idiots don't make a genius.
-
Feb 1st, 2005, 12:16 PM
#9
Re: Sending e-mails from Access using Outlook [resolved]
Depends on how his module code is. If he has a reference to Outlook added
then use the olFormatHTML. If not then its Access' CDO default reference, I
think is how it is?
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 1st, 2005, 12:18 PM
#10
Re: Sending e-mails from Access using Outlook [resolved]
ahem * cough * ahem - he wants plain text...
Nobody knows what software they want until after you've delivered what they originally asked for.
Don't solve problems which don't exist.
"If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)
2 idiots don't make a genius.
-
Feb 1st, 2005, 12:21 PM
#11
Re: Sending e-mails from Access using Outlook [resolved]
Doh! Thats right. olFormatPlain it is then.
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
|