Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Single line in email body? 1

Status
Not open for further replies.

Davidmc555

Programmer
Feb 7, 2005
39
GB
I'm having a problem with a bit of code I'm writing. It's for email notification when an ASP.NET web app completes.

Code:
 'Create an instance of the MailMessage class

                'Set the properties
                objMM.To = "support@mycompany.com"
                'objMM.To = "david.mcgeown@mycompany.com"
                objMM.From = "supportOZ@mycompany.com"

                'Send the email in HTML format
                objMM.BodyFormat = MailFormat.Text

                'Set the priority
                objMM.Priority = MailPriority.Normal

                'Set the subject
                objMM.Subject = "License and Activation for client"

                'Set the body
                strBody = "An activation has been generated for the following client." & (Chr(13)) & "Client ID = " & txtClientID.Text & (Chr(13)) & "Client Name = " & txtClientName.Text & (Chr(13)) & "License Code = " & txtLicenseKey.Text & (Chr(13)) & "Activation Code = " & txtActivKey.Text & (Chr(13)) & "Number of Users = " & ddlUsers.SelectedValue
                objMM.Body = strBody

                'Specify the Smtp Server
                SmtpMail.SmtpServer = "mail.mycompany.com"

                'send the message
                SmtpMail.Send(objMM)

No shockers there, I'm sure you'll agree. During testing I sent the test emails to myself rather than the support group and got the following email.

"An activation has been generated for the following client.

Client ID = 1234
Client Name = Email Test UK
License Code = 1234-1234-1234-1234
Activation Code = 444444
Number of Users = 5"

That's fine, that's what I want. So I tried it with the other email address for support and got...

"An activation has been generated for the following client."

That's it. I've tried a number of things like replacing the string but it always has the same effect. Any clues as to where I'm going wrong?

Cheers in advance.
 
Maybe Chr(13) isn't acceptable to that email provider. You could try Environment.NewLine (that's in C#, I assume something similar is in VB).

TWljcm8kb2Z0J3MgIzEgRmFuIQ==
 
Wah ha! You genius you! That's what it was. VB does have the Environment.Newline command by the way.

Strange it worked for my email but no the support group.

Anyway, thank again. Have a good weekend!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top