Author |
|
nwebster Newbie
Joined: 12 April 2005 Location: United States
Online Status: Offline Posts: 9
|
Posted: 06 September 2005 at 8:20am | IP Logged
|
|
|
I've noticed that when I try and pull a .msg or .eml file as an attachment from a message, it isn't saving the attachment as it does with any other type of file. Is there something special I need to set for these file types?
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 06 September 2005 at 9:30am | IP Logged
|
|
|
This is because .msg or .eml attachments often missing the filename. In your code, you should check if the filename is not empty first:
Code:
' Assume Attach is MailBee.Attachment object
If Attach.Filename = "" Then
Attach.SaveFile "C:\Temp", "noname.eml"
Else
Attach.SaveFile "C:\Temp"
End If
|
|
|
Regards,
Alex
|
Back to Top |
|
|
nwebster Newbie
Joined: 12 April 2005 Location: United States
Online Status: Offline Posts: 9
|
Posted: 06 September 2005 at 12:46pm | IP Logged
|
|
|
Really? How would it not have a filename? I've always seen them with the subject as the filename. I will try that though.
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 06 September 2005 at 12:55pm | IP Logged
|
|
|
When forwarded email has no filename, Outlook uses this mail's subject + ".eml" to generate a filename.
Regards,
Alex
|
Back to Top |
|
|
nwebster Newbie
Joined: 12 April 2005 Location: United States
Online Status: Offline Posts: 9
|
Posted: 08 September 2005 at 8:05am | IP Logged
|
|
|
I tried to check the filename, but when I changed my code from this:
oMsg.Attachments(1).SaveFile(FilePath)
to this:
If oMsg.Attachments(1).Filename = "" Then &n bsp; &n bsp; &n bsp;
oMsg.Attachments(1).SaveFile(FilePath), "noname.eml"
Else &n bsp; &n bsp; &n bsp;
oMsg.Attachments(1).SaveFile(FilePath)
End If
But it won't compule with the , "noname.eml" added on, displaying a message saying "end of statement expected". What needs to change?
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 08 September 2005 at 9:10am | IP Logged
|
|
|
You should replace this:
oMsg.Attachments(1).SaveFile(FilePath), "noname.eml"
with this:
oMsg.Attachments(1).SaveFile FilePath, "noname.eml"
Regards,
Alex
|
Back to Top |
|
|
nwebster Newbie
Joined: 12 April 2005 Location: United States
Online Status: Offline Posts: 9
|
Posted: 08 September 2005 at 9:49am | IP Logged
|
|
|
That did it, thanks!
|
Back to Top |
|
|
sportsc Newbie
Joined: 22 December 2006 Location: Greece
Online Status: Offline Posts: 1
|
Posted: 22 December 2006 at 5:07am | IP Logged
|
|
|
Hi,
I also have the same problem.
attachment filename returns empty. the HasAttchment is true and the Count is 1.
When I ask for the Attachmnet.Content it returns the attachment's content with headers:
Content-Type:application/octet-stream;name="0219_20061221.cs v"
Content-Transfer-Encoding:base64
content-Disposition:inline;filename="0219_2001221.csv"
Content-MD5:NEMIP
How can I get the filename? And save the file? I need to save the file on disk with the name it has on the email.
Thank you
|
Back to Top |
|
|
Andrew AfterLogic Support
Joined: 28 April 2006 Location: United States
Online Status: Offline Posts: 1189
|
Posted: 22 December 2006 at 6:31am | IP Logged
|
|
|
We created a test message with headers you provided and got the filename of the attachment via MailBee Objects successfully.
Could you please provide us with the full message (as .eml file) which causes the issue? You can send it to support@afterlogic.com.
Best regards,
Andrew
|
Back to Top |
|
|