Author |
|
jmckinney Newbie
Joined: 09 June 2007 Location: United States
Online Status: Offline Posts: 2
|
Posted: 09 June 2007 at 10:33am | IP Logged
|
|
|
Hello,
We have an issue with forwarding emails from outlook where an email is attached with the .EML extension and sent with the forwarded message. When trying to save the attachments for these objects, there seems to be no valid filename created with the Attachments functions. Does mail be do any kind of stripping of .EML or .MSG messages or is there a better way to handle these as attachments?
Thanks
John
|
Back to Top |
|
|
jmckinney Newbie
Joined: 09 June 2007 Location: United States
Online Status: Offline Posts: 2
|
Posted: 09 June 2007 at 11:38am | IP Logged
|
|
|
Here is some sample code that I am using to load one of the messages.
It outputs the filenames at the end, which read as normal for regular attachments, and blank for .MSG attachments, appearing that the attachment filename is dropped:
Response.Write("<br>" + CStr(i) + "<br>strFromName=" + Server.HTMLEncode(Msg.FromAddr) + " Name :" + Msg.FromFriendlyName)
Response.Write("<br>toAddress=" + Server.HTMLEncode(Msg.ToAddr))
Response.Write("<br>Subject=" + Msg.Subject + "<hr>")
If Msg.BodyFormat = 1 Then
' Display HTML-formatted message directly
Response.Write Msg.BodyText
Else
' For non-HTML messages, we need to prepare the message
' for viewing in the browser
Response.Write "<pre>"
Response.Write Server.HTMLEncode(Msg.BodyText)
Response.Write "</pre>"
End If
'Response.Write("<br>Mailer.BodyText=" + Msg.BodyText)
Response.Write("<hr><br><br>Attachment Count: " & Msg.Attachments.Count)
If Msg.Attachments.Count > 0 Then &n bsp;
For j = 1 To Msg.Attachments.Count &nb sp; &nb sp; &nb sp; &nb sp; &nb sp;
Response.Write ("<br>Attachment #" & j & ": " & Msg.Attachments(j).Filename)
Next
End If
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 10 June 2007 at 7:58am | IP Logged
|
|
|
Yes, that's correct. If you open such .EML file in a text viewer, you'll see there is indeed no name.
You should invent your own filename in this situation (like Outlook does). For instance:
Code:
k = 1
For j = 1 To Msg.Attachments.Count
If Msg.Attachment[j].Filename = "" Then
filename = "att_" & k & ".att"
k = k + 1
Else
filename = Msg.Attachment[j].Filename
End If
Next
|
|
|
Regards,
Alex
|
Back to Top |
|
|