Solved

Characters appearing in email sent via SMTP

Posted on 2006-11-05
5
463 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
ID: 17879012
Try this:
.BodyEncoding = MailFormat.Base64
0
 
LVL 1

Author Comment

by:obyapka
ID: 17879880
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
ID: 17879910
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
ID: 17880139
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
ID: 17886089
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

914 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

19 Experts available now in Live!

Get 1:1 Help Now