Author |
|
Guests Guest Group
Joined: 10 November 2003
Online Status: Online Posts: 262
|
Posted: 02 June 2005 at 1:50pm | IP Logged
|
|
|
I'm writing an application that takes records from a database and sends out emails (with attachments) based on selected records from this database. The majority of Mailer.Message.'things' are coming from predefined application variables or from data elements within the database. I'm having difficulty taking a field item from the database and adding the item as an attachment (the field contains file names).
Code:
oMailer.Message.FromAddr = PPSFrom
oMailer.Message.ToAddr = PPSTo
oMailer.Message.Subject = PPSSubject
oMailer.Message.BodyText = PPSMsg
PPSAttach = Chr$(34) & Trim(PPSRefreshDirectory) & Trim(PPSFilNam) & Chr$(34)
oMailer.Message.AddAttachment PPSAttach
note - i've tried this with the chr$(34) included and excluded, neither one worked. I've also replaced the PPSAttach variable with "somedirectory\somefile.zip" and THAT worked.
Could you please let me know what I'm doing wrong here or could you please give me a suggestion as to what to do. The message comes thru, but with no attachment
Kurt Tietjen
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 02 June 2005 at 2:24pm | IP Logged
|
|
|
Have you tried to take a look at PPSAttach content?
Code:
PPSAttach = Chr$(34) & Trim(PPSRefreshDirectory) & Trim(PPSFilNam) & Chr$(34)
MsgBox PPSAttach
|
|
|
Chr$(34) chars should be excluded. Also, you're probably missing backslash character between folder name and filename.
You can try this:
Code:
PPSAttach = Trim(PPSRefreshDirectory) & "\" & Trim(PPSFilNam)
MsgBox PPSAttach
|
|
|
Make sure PPSAttach contains valid file path now. Also, it might be more reliable to include full path to PPSRefreshDirectory. This will eliminate problems caused by accessing folders which do not reside in your application's folder.
Regards,
Alex
|
Back to Top |
|
|