Creating Eudora email with PDF Attachments

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I can do this with Outlook - using CreateObject(Outlook.Application), but I
haven't yet figured out how to call Eudora to do the same. Any leads would
be most helpful!

Thanks,

- Andy
 
badmoonrising said:
I can do this with Outlook - using CreateObject(Outlook.Application), but I
haven't yet figured out how to call Eudora to do the same. Any leads
would
be most helpful!

Here's code I've used. It's not too clean, but enough to get the idea. There
are 2 approaches given, one using a text file and one using OLE.

Case "Eudora" 'Use Eudora
'Prepare a mail message file in Eudora's format. _
Each header goes on a separate line. _
A blank line separates the headers from the message text.
Dim strTempFileName As String

'Need to verify the CC & BCC work correctly*********************
strOut = "To: " & strAddress & vbCrLf & _
"CC: " & strCCAddress & vbCrLf & _
"BCC: " & strBCCAddress & vbCrLf & _
"Subject: " & strSubject & vbCrLf
If strAttachFileName <> "" Then
strOut = strOut & "X-Attachments: " & strAttachFileName & vbCrLf
End If
strOut = strOut & vbCrLf & strText

'Write the mail message file
'******** NEED TO FIX THIS FILE LOCATION ************
strTempFileName = pjsCreateTempFile(strFileNamePrefix:="eud",
strDirectoryPath:="C:\Temp\")
If strTempFileName = "" Then
MsgBox "Could not create a temporary mail message file",
vbExclamation, _
"Check free disk space"
Else
'Mail file must have a ".msg" extension for Eudora to process it
strMailFileName = Left$(strTempFileName, Len(strTempFileName) -
3) & "msg"
intFileNum = FreeFile
Open strMailFileName For Output As intFileNum
Write #intFileNum, strOut
Close intFileNum

'Shell to Eudora to send the message
'******** NEED TO FIX THIS call to Eudora ************
Call Shell(PathName:="C:\Program Files\Eudora\Eudora.exe " &
strMailFileName, _
WindowStyle:=IIf(fPreviewMessage, vbNormalFocus,
vbMinimizedNoFocus))
'Kill strTempFileName
'Kill strMailFileName
fSuccess = True 'Successful if we get
here???
End If

'Eudora gets the foreground window in some versions. _
Make sure Access stays on top.
'Call pjsActivateAccess
Case "EudoraOLE" 'Use Eudora OLE (version 4.0 or later. Works better
with 4.1 or later.)
Dim oEudora As Object
Const cstrEudoraServerName As String = "Eudora.EuApplication.1"

Set oEudora = GetObject(, cstrEudoraServerName) 'This NEVER finds a
running version
If oEudora Is Nothing Then
Set oEudora = CreateObject(cstrEudoraServerName)
If Not oEudora Is Nothing Then
oEudora.Visible = True
End If
End If
If oEudora Is Nothing Then
MsgBox "Could not initialize the Eudora Application", _
vbCritical, "Cannot send the message"
GoTo ExitHandler
End If
'Eudora's settings may DELETE an attached file. _
Until this is resolved, don't send attachments.
If Len(strAttachFileName) > 0 Then
MsgBox "The requested attachment, " & strAttachFileName _
& " will NOT be included due to an optional setting in Eudora "
_
& "which might DELETE the attachment document."
End If
Call oEudora.QueueMessage(To:=strAddress, CC:=strCCAddress,
BCC:=strBCCAddress, _
Subject:=strSubject, Attach:="", Body:=strText)
fSuccess = True 'Successful if we get here???
 
Thanks, Paul. I tried it both ways and couldn't get the info to be put into
the email in the top method. But the bottom method works great - even with
attachments! I appreciate you taking the time to respond. Cheers.
 
Back
Top