?
Solved

Characters appearing in email sent via SMTP

Posted on 2006-11-05
5
Medium Priority
?
478 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 375 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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

764 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