This project is read-only.
1
Vote

Unwanted attachments like "Untitled attachment 00445.txt"

description

When I send a mail it has an unwanted attachment lijke "Untitled attachment 00445.txt"

The content of the attachment is the bodytext
When the body is in html the attachment is like "Att00*.htm"

I changed the code an compiled it in the development system it works now without thw unwanted attachments but on the production server they still appear with the samen executable.

I have no idea why the same program workd different in the production server.
Anybody has an suggestion?

Thanks,
Rob Molenkamp

comments

r0m0l wrote Nov 4, 2015 at 12:03 PM

This is the code that creates a new message namend msgOutNew and fills it with the content of a previously created message msgOut. This code prvent the unwanted attachment in the development system but in the production system they appear using the same executable.

// Nieuwe email aanmaken om extraa bijlagen te voorkomen 15-10-2015
                        // ****************************************************************
                        // Globals.Log.LogDebug("Filter::FilterAttachments: Opbouw msgOutNew zonder vreemde MS Exchange bijlagen START", 5);

                        Message msgOutNew = new Message();

                        if (!msgOut.IsHtml)
                        {
                            msgOutNew.BodyText = msgOut.BodyText;   
                        }

                        if (msgOut.IsHtml)
                        {
                            msgOutNew.IsHtml = msgOut.IsHtml;
                            msgOutNew.BodyHtml = msgOut.BodyHtml;  
                        }


                        msgOutNew.Subject = msgOut.Subject;
                        msgOutNew.To = msgOut.To;
                        msgOutNew.From = msgOut.From;

                        // Voeg nu alle UnknownMimeParts van msgOut toe aan msgOutNew anders leegmaken
                        // ***************************************************************************
                        if (msgOut.UnknownDispositionMimeParts.Count > 0)
                        {
                            Globals.Log.LogDebug("Filter::FilterAttachments: Opbouw msgOutNew  met " + msgOut.UnknownDispositionMimeParts.Count + " UnknownDispositionMimeParts.", 5);
                            foreach (MimePart udmp in msgOut.UnknownDispositionMimeParts)
                            {
                                if(udmp.MimeType != "text/plain")
                                { 
                                    msgOutNew.UnknownDispositionMimeParts.Add(udmp); 
                                }
                                // msgOutNew.UnknownDispositionMimeParts.Add(udmp);
                           }
                        }
                        else
                        {
                            msgOutNew.UnknownDispositionMimeParts.Clear();
                        }


                        // Voeg nu alle EmbeddedObjects van msgOut toe aan msgOutNew anders leegmaken
                        // **************************************************************************
                        if (msgOut.EmbeddedObjects.Count > 0)
                        {
                            Globals.Log.LogDebug("Filter::FilterAttachments: Opbouw msgOutNew  met " + msgOut.EmbeddedObjects.Count + " EmbeddedObjects.", 5);
                            foreach (MimePart emobj in msgOut.UnknownDispositionMimeParts)
                            {
                                msgOutNew.EmbeddedObjects.Add(emobj);
                            }
                        }
                        else
                        {
                            msgOutNew.EmbeddedObjects.Clear();
                        }

                        // Voeg nu alle bijlagen van msgOut toe aan msgOutNew anders leegmaken
                        // *******************************************************************
                        if (msgOut.Attachments.Count > 0)
                        {
                            Globals.Log.LogDebug("Filter::FilterAttachments: Opbouw msgOutNew  met " + msgOut.Attachments.Count + " Attachments.", 5);
                            foreach (MimePart attFile in msgOut.Attachments)
                            {
                                msgOutNew.Attachments.Add(attFile);
                            }
                        }
                        else
                        {
                            msgOutNew.Attachments.Clear();
                        }

                        msgOutNew.BuildMimePartTree();

                        // Nieuwe email aanmaken om extraa bijlagen te voorkomen 15-10-2015
                        // ****************************************************************

MZimmermann wrote Nov 11, 2015 at 5:16 PM

What is the difference between the to systems?
Where does msgOut come from, is it imported received from anywhere or created, too?

RobMolenkamp wrote Nov 12, 2015 at 3:15 PM

There is no difference as it seems both are Windows 2008 r2 servers.
msgOut is a working copy of the original incoming mail message.