BUG: Periods / Fullstops removed from MailMessage attachments

S

Simon Knox

Hi

I have come across an apparant bug while using SmtpMail. The problem I have
is that if a MailAttachment has a line in it that starts with a fullstop (
or period for those of you that speak American english ) then the fullstop
is removed. This is an example of how I am using SmtpMail and MailMessage:

MailMessage mail = new MailMessage();
mail.From = "(e-mail address removed)";
mail.To ="(e-mail address removed)";
mail.Subject = "Where did the . go?";
mail.Body = "Test";
mail.BodyFormat = MailFormat.Text;
mail.Attachments.Add( ( new MailAttachment( "C:\\Test.txt" ) ) );

SmtpMail.SmtpServer = System.Net.Dns.GetHostName();
SmtpMail.Send( mail );

The problem is that if C:\Test.txt has the following text:

..net
..5 w
..5
..78

then the following will be the contents of the attachment Test.txt when it
is recieved

net
5 w
5
78

This causes the PDF files that I am attaching to not display properly as
some of the lines start with .5 w

If anyone can see what I am doing wrong or knows a way around this then I
would appreciate their advice.

Thanks

Simon
 
J

Jeffrey Tan[MSFT]

Hi Simon,

Thank you for posting in the community! My name is Jeffrey, and I will be
assisting you on this issue.

Based on my understanding, when you use SmtpMail and MailMessage to send
email which has one text file attached, your text file's content was
modified.(the "dot" was removed)
=======================================================
I have tested your code, in my side, it works well, my text file will not
be modified.
Based on my experience, the problem may be that your proxy server or
firewall changes your attachment's content.

Have you tried other file types, such as pdf, word, etc?

I will wait for your further feedback.

======================================================
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
S

Simon Knox

Hi Jeffery

Thanks for your reply.

The file that I was sending out was a pdf file and that was being modified.
When I was sending out more than one pdf file I was putting them in a zip
file. The zip files were not being altered but that might be because they
didn't have any lines starting with a dot. I will have a look at the
settings for the proxy server and the firewall and see if I can see anything
there. Failing that as a last resort I can insert a extra dot at the
beginning of any lines that begin with a dot.

thanks

Simon
 
J

Jeffrey Tan[MSFT]

Hi Simon,

Thanks for your feedback.

I think even you add more dots in your text file, the firewall may remove
all the dots.
I think you may workaround this through change your file's extension, such
as change your test.pdf to test.dat, so that the file content will not be
changed.

Anyway, I will wait for your feedback after checking proxy server and
firewall. I will work with you.
Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top