Solved

Characters appearing in email sent via SMTP

Posted on 2006-11-05
5
461 Views
Last Modified: 2010-04-07
Hi,

I've written an application for my company that will send an automated email when a certain condition has been met. The text for these emails originates from a text file. When the email has been sent and arrives in a users mail box, an exclamation mark appears at approximately character 990.

I've done a test just sending the characters 1234567890 and its nothing to do with the text file, and I've played with bodyencoding and bodyformat to no avail. Any ideas?

       With CfH_Message
            .From = From
            .To = To
            .Subject = Subject
            .Body = Message
            .BodyFormat = MailFormat.Html
            .BodyEncoding = System.Text.Encoding.Default
        End With
        SmtpMail.SmtpServer = ConfigurationSettings.AppSettings("SMTPServerAddress")
        SmtpMail.Send(CfH_Message)


using the 1234567890 the results are as below (note the ! towards the end). The ! does NOT appear in the text email message. The proper text is in the form of a Dear Jo Bloggs email to a user, who happened to notice the exclamation mark towards the end of the email amongst various words (depending on the email). How has it appeared? This has been added AFTER the smtpmail.send. How can it be cured?


12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789! 01234567890
0
Comment
Question by:obyapka
  • 3
5 Comments
 
LVL 12

Expert Comment

by:sandip132
Comment Utility
Try this:
.BodyEncoding = MailFormat.Base64
0
 
LVL 1

Author Comment

by:obyapka
Comment Utility
MailFormat.Base64 does not appear as an option - only .HTML and .TEXT appear.

btw I'm using ASP.NET v1.1
0
 
LVL 1

Author Comment

by:obyapka
Comment Utility
MailEncoding.Base64 exists but setting .BodyEncoding to this results in
"Value of type 'System.Web.Mail.MailEncoding' cannot be converted to 'System.Text.Encoding"

I'm using Imports System.Web.Mail, allowing me to do  Dim Cfh_Message As New MailMessage

examples that I've seen on the net that use MailEncoding.Base64 appear to use System.Web.Util, but if I use this I cannot create a mail object as above!!! (Type MailMessage is not defined). Grrrrr


0
 
LVL 15

Accepted Solution

by:
crisco96 earned 125 total points
Comment Utility
There's a strange bug where if you have a string of length 512 or more without a line break random exclamation points appear in the email body. Add some code to insert a line break every 400-500 characters.
0
 
LVL 1

Author Comment

by:obyapka
Comment Utility
I discovered a similar idea - see http://www.systemwebmail.com/faq/4.4.5.aspx - need to do a vbcrlf after every paragraph - I've applied a patch and it appears to work!! :-)
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now