|
I have a client that doesn't have Outlook accounts
available on the application server, so we resorted to using the CDO library to
send email. You can essentially do everything you can with Outlook -
except edit the email prior to sending. The CDO library does not raise any
type of security warning.
My routine looks like this:
(the bolded parts are system option functions - you can
replace these with literal strings)
'***** code start *****'
Public Function SendCDOMail(strTo As String, strSubject As
String, strBody As String, strAttach As String, blnHTML As Boolean) As
Boolean
On Error GoTo Failure Dim objMessage As
CDO.Message
Dim objConfig As CDO.Configuration Dim objFields As Variant Const cboSendUsingPort As Integer = 2 Set objConfig = New CDO.Configuration Set objMessage = New CDO.Message Set objFields = objConfig.Fields With objFields .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = GetSMTPServer() '<-- valid SMTP server .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10 .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 .Update End With With objMessage Set .Configuration = objConfig .TO = strTo .From = GetNTUSER & "@" & GetMailDomain() '<-- automatically uses current user as "From" .Subject = strSubject If blnHTML = True Then .HTMLBody = strBody Else .TextBody = strBody End If If strAttach <> "" Then .AddAttachment (strAttach) .Send End With Set objMessage = Nothing Set objFields = Nothing Set objConfig = Nothing SendCDOMail = True EXITROUTINE: Exit Function Failure: SendCDOMail = False MsgBox Err & " " & Err.Description Resume EXITROUTINE End Function '***** code end *****' Tom Oakes From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Eric Douglas Sent: Tuesday, August 09, 2005 10:42 AM To: [email protected] Subject: RE: [AccessDevelopers] E-mail with spreadsheet attachment I'll look at that - but I actually don't have Outlook send the
message. Instead, I always set the "Edit Before Sending" option to True,
so the user has to press Send to send the e-mail. It still requires user
input, but is nicer than that dialog box.
Thanks for the link, I've wondered if there is a good solution to this
issue.
Please zip all files prior to uploading to Files section.
SPONSORED LINKS
YAHOO! GROUPS LINKS
|
Title: E-mail with spreadsheet attachment
- [AccessDevelopers] E-mail with spreadsheet attachm... Hoffman, Tobi K \(DYS\)
- RE: [AccessDevelopers] E-mail with spreadshee... Eric Douglas
- RE: [AccessDevelopers] E-mail with spreadshee... Lava Boggavarapu
- RE: [AccessDevelopers] E-mail with spreadshee... Eric Douglas
- RE: [AccessDevelopers] E-mail with spread... Tom Oakes
- Re: [AccessDevelopers] E-mail with sp... Toby Bierly
- RE: [AccessDevelopers] E-mail wit... Tom Oakes
- RE: [AccessDevelopers] E-mail with spreadshee... Hoffman, Tobi K \(DYS\)
