473,385 Members | 1,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

! and spaces added to email when sending email in .net application

When using the NewMail.Body object, ! and spaces are being added into
the email after the email has been sent. Has anyone else had this
problem or even better a solution??
Nov 20 '05 #1
3 1513
Cor
Hi Nicola,

Paste in some code, maybe we can help you?

(When you do that first to the notebook and then copy from there in the
mail, otherwise we get a very long message)

Cor
When using the NewMail.Body object, ! and spaces are being added into
the email after the email has been sent. Has anyone else had this
problem or even better a solution??

Nov 20 '05 #2
"Cor" <no*@non.com> wrote in message news:<#Z**************@TK2MSFTNGP12.phx.gbl>...
Hi Nicola,

Paste in some code, maybe we can help you?

(When you do that first to the notebook and then copy from there in the
mail, otherwise we get a very long message)

Cor
When using the NewMail.Body object, ! and spaces are being added into
the email after the email has been sent. Has anyone else had this
problem or even better a solution??


Cor,
Here's the code to build up email

strLine1 = "<table border='0' cellpadding='0' cellspacing='0'
width='600'>"
strLine2 = "<tr><td width='100%'><p align='right'>Permit
Number......................</p></td></tr>"
strLine3 = "<tr><td width='100%'><p align='right'>Permit
Date...........................</p></td></tr>"
strLine4 = "<tr><td width='100%' align='center'><b>GLASGOW
CITY COUNCIL</b></td></tr>"
strLine5 = "<tr><td width='100%' align='center'><b>LAND
SERVICES</b></td></tr>"
strLine6 = "<tr><td width='100%'
align='center'><b>PERMISSION TO OCCUPY PORTIONS OF A
ROAD</b></td></tr>"
strLine7 = "<tr><td width='100%'>Glasgow City Council in
exercise of their powers under Section 59 of the Roads </td></tr>"
strLine8 = "<tr><td width='100%'>(Scotland) Act 1984 (and
under Section 14 of the Road Traffic Regulation Act 1984) </td></tr>"
strLine9 = "<tr><td width='100%'>hereby grant permission
to :-</td></tr>"
strLine10 = "<tr><td width='100%'>Name:</td></tr>"
strLine101 = "<tr><td width='100%'>" & strName &
"</td></tr>"
strLine11 = "<tr><td width='100%'>Address:</td></tr>"
strLine102 = "<tr><td width='100%'>" & strFlat &
strHouseName & strAddress & "</td></tr>"
strLine12 = "<tr><td width='100%'>Postcode: " & strPcode &
"</td></tr>"
strLine13 = "<tr><td width='100%'>Telephone No.: " &
strPhone & "</td></tr>"
strLine14 = "<tr><td width='100%'>Fax
No.:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;" & strFax &
"</td></tr>"
strLine15 = "<tr><td
width='100%'>E-mail:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&nbsp;"
& strEmail & "</td></tr>"
strLine16 = "<tr><td width='100%'>to place or cause to be
placed a Simon Tower on the carriageway of</td></tr>"
strLine17 = "<tr><td width='100%'>" & strCarriageway &
"</td></tr>"
strLine18 = "<tr><td width='100%'>From " & strDateFrom & "
To " & strDateTo & "</td></tr>"
strLine19 = "<tr><td width='100%'>subject to the
conditions specified in Appendix II and hereby authorise and
require</td></tr>"
strLine103 = "<tr><td width='100%''>the said (Name) " &
strContact & "</td></tr>"
strLine20 = "<tr><td width='100%'>to place on the highway
such traffic signs as may be necessary to comply with the </td></tr>"
strLine21 = "<tr><td width='100%'>conditions of this
permission.</td></tr>"
strLine22 = "<tr><td
width='100%'>---------------------------------------------------------------------------------------------------------------</td></tr>"
strLine23 = "<tr><td width='100%'><font size = '1'>OFFICE
USE ONLY</font></td></tr>"
strLine24 = "<tr><td
width='100%'>Operations_Manager................... ................................................Da te:......................</td></tr>"
strLine25 = "<tr><td
width='100%'>----------------------------------------------------------------------------------------------------------------</td></tr>"
strLine26 = "<tr><td width='100%'>Appendix I</td></tr>"
strLine104 = "<tr><td width='100%'>Sketch plans showing
proposed location of Crane and details of dimensions with </td></tr>"
strLine105 = "<tr><td width='100%'>outriggers in use.
Permits will be issued with the condition that a plan (if required)"
strLine108 = "<tr><td width='100%'>is provided by post or
fax.</td></tr>"
strLine27 = "<tr><td width='100%'>Appendix II</td></tr>"
strLine106 = "<tr><td width='100%'>Conditions pertaining
to this permission</td></tr>"
strLine109 = "<tr><td
width='100%'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>"
strLine28 = "<tr><td width='100%'>I hereby agree to comply
with the conditions.</td></tr>"
strLine107 = "<tr><td
width='100%'>&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>"
strLine29 = "<tr><td width='100%'>To be signed by
applicant on receipt........................................... ...</td></tr>"
strLine110 = "<tr><td
width='100%'>&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>"
strLine30 = "<tr><td width='100%'><b>AUTHORISATION
STAMP</b></td></tr>"
strLine111 = "<tr><td width='100%'>This certificate must
be shown if requested to a policeman or to any officer of Glasgow City
Council. It is valid only if if carries the Glasgow City Council stamp
of authorisation and it is a condition that the opening be made within
a period of ten days from the date of issue.</td></tr>"
strLine112 = "<tr><td
width='100%'>&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>"
strLine31 = "<tr><td width='100%'>This authorised permit
is to be&nbsp;" & strDelivery & "</td></tr>"
strLine32 = "</table>"

Code for email class
Public Class gccEmail
' public EMail Class for sending an email using information from
form
' The four Parameters to send using SendMail Function are:
' MailFrom - Addree where Email is from (string)
' MailTo - Address where Email to be sent (string)
' MailSubject - Description/Subject of the Email (string)
' MailBody - The Text of the Email (string)
' A true or False Boolean value is returned
'(IF True there is no errors and email is sent IF False there
are errors and no email sent)
Public Shared Function SendMail(ByVal MailFrom As String, ByVal
MailTo As String, ByVal MailSubject As String, ByVal MailBody As
String) As Boolean
Dim NewMail As New MailMessage()
Try
If MailFrom <> "" Then
NewMail.From = MailFrom
ElseIf MailFrom = "" Then
NewMail.From = "In******@gov.uk"
End If
NewMail.Body = MailBody
NewMail.To = MailTo
NewMail.Subject = MailSubject
NewMail.BodyFormat = MailFormat.Html
NewMail.Priority = MailPriority.Normal
SmtpMail.SmtpServer = "HAHTsitemail"
SmtpMail.Send(NewMail)
Catch
Return False
End Try
Return True
End Function
End Class
Nov 20 '05 #3
Cor
Hi Nicola,

I see in your message some (incomplete) code to put HTML lines on a webpage.

A normal shared mailfunction, that will be activated by

SendMail(MailFrom, MailTo , MailSubject, MailBody)

With that function I see as far as I can see it now nothing wrong

But there is is a lot of generated HTML code, from what I asume you make
the MailBody, (the code is not there) did you try it with just an empty
body, I think that is the best approach to see it the ! is by the HTML or
just by something else.

Cor

Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Nathan Sokalski | last post by:
I am using ASP to read code from a text file that I am displaying on my page. Because I do not want the code from the text file to be executed, I used the Server.HTMLEncode() method to display it...
88
by: Mike | last post by:
Is there a way to determine what a user's default email client is? I read a post from 3 years ago that said no. I guess I'm hoping something has come along since then.
13
by: joe215 | last post by:
I want my users to send emails from a Windows app that I am developing in Visual Basic.NET 2003. I found a good example of sending email to a SMTP server using the SmtpMail class. However, using...
7
by: ITM | last post by:
Can anyone tell me how I can prevent Access adding trailing spaces when I insert a value into a Text column? For example, if I execute the following statement: UPDATE Log SET Log.Title =...
6
by: eight02645999 | last post by:
hi wish to ask a qns on strip i wish to strip all spaces in front of a line (in text file) f = open("textfile","rU") while (1): line = f.readline().strip() if line == '': break print line
17
by: tommy | last post by:
Hi all, I' m adding strings to some fields in my table via Access. The strings sometimes have trailing spaces and I really need to have it that way, but Access truncates trailing spaces. How can...
1
by: xin.yadong | last post by:
Hi: I have a shared function for sending Email using SMTP. It works fine in a ASP.NET web application. But when I use it in a VB.Net Windows application, it always gave me an error: "Could not...
2
by: =?Utf-8?B?U2hydXRpIERlc2hwYW5kZQ==?= | last post by:
I am developing an application in vb.net 2005 to send email via outlook. The mail body contains key - value pairs like Account Number : 232323 CRS Number : 872732 Name :...
6
by: Adrian | last post by:
How do I stop spaces from disappearing in an email I make up in an application? I found that \r\n has to be replaced by other characters, so presumably spaces have to be replaced as well: but by...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.