473,406 Members | 2,345 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,406 software developers and data experts.

myMessage.body question

Hello

In the following SMTP code, have I coded myMessage.Body correctly, please?

Expand|Select|Wrap|Line Numbers
  1. myMessage.From = New MailAddress("info@mysite.net") 'Webmaster's email
  2. myMessage.To.Add(New MailAddress(strEmailValue)) 'user's email
  3. myMessage.Subject = ("Password Reset Request")
  4.  
  5. 'myMessage.Body = "Please click on the following link to reset your password: <br/>Link<br/><br/>Thank you<br/>"
  6.  
  7. myMessage.Body = ""            myMessage.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure
  8. myMessage.IsBodyHtml = True
  9. myMessage.Priority = MailPriority.Normal
  10.  
  11. Dim PlainMessage As AlternateView = AlternateView.CreateAlternateViewFromString("Hello. To reset your password, please click on this link", Nothing, "text/plain")
  12.  
  13. Dim mimeType As ContentType = New ContentType("text/html")
  14.  
  15. Dim HtmlMessage As AlternateView = AlternateView.CreateAlternateViewFromString("<img src=cid:dimaHeader><br /><br /><br ><body style='font-family:candara; color:#ffffff; background-color:#858585; margin-left:2em;'>Hello " & strEmailValue & "<br /><br /> To reset your password, please click on this <a href='http://www.dimadayoub.net/newPassword.aspx?token=" & uniqueCode & "' style='color: #0000FF; text-decoration: none;'>link</a><br /><br />Thank you<br /><br />Regards<br /></br />Dima<br /><br ><a href='http://www.dimadayoub.net' target='_blank' style='color: #0000FF; text-decoration: none;'>http://www.dimadayoub.net</a></body>", Nothing, "text/html")
I have commented out:

Expand|Select|Wrap|Line Numbers
  1. 'myMessage.Body = "Please click on the following link...
and set this to nothing

Expand|Select|Wrap|Line Numbers
  1.  myMessage.Body = ""
because I have included the body and link instead in the following two lines:

Expand|Select|Wrap|Line Numbers
  1. Dim PlainMessage As AlternateView = AlternateView.CreateAlternateViewFromString("Hello. To reset your password, please click on this link", Nothing, "text/plain")
  2.  Dim HtmlMessage As AlternateView = AlternateView.CreateAlternateViewFromString("<img src=cid:dimaHeader><br /><br /><br ><body style='font-family:candara; color:#ffffff; background-color:#858585; margin-left:2em;'>Hello " & strEmailValue & "<br /><br /> To reset your password, please click on this <a href='http://www.dimadayoub.net/newPassword.aspx?token=" & uniqueCode & "' style='color: #0000FF; text-decoration: none;'>link</a><br /><br />Thank you<br /><br />Regards<br /></br />Dima<br /><br ><a href='http://www.dimadayoub.net' target='_blank' style='color: #0000FF; text-decoration: none;'>http://www.dimadayoub.net</a></body>", Nothing, "text/html")
The idea is that the HTML-email that is sent to the user who has forgotten his password, contains a link for him to
reset his password, but I am getting an 'Authentication required' error. Despite the server error, it is unrelated to SMTP credentials, so I am trying to isolate where the problem really lies.

Thanks.
Apr 4 '18 #1
0 1751

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: andrew blah | last post by:
Hello, I need to get the text of the body (the payload) of an email. As I understand it, an email has headers at the top, then a blank line, then the body of the message. I want to get the...
1
by: Vi | last post by:
Hi, Is there a simple way to send an email from ASP.NET using the MailMessage class with MyMessage.BodyFormat = MailFormat.Html, such that the body of the email will come from an existing HTML...
6
by: Ashok | last post by:
Hi, I am starting a new project to build a software product using APS.NET 2.0. In past I have used "frameset" and "frame" to build pages. My current requirements I have coded using frameset and...
0
by: robert | last post by:
Hi all, I'm having a hard time resolving a namespace issue in my wsdl. Here's an element that explains my question, with the full wsdl below: <definitions name="MaragatoService"...
5
by: Joh | last post by:
I'm using mailto to open up an email that have a hyperlink in the body. The hyperlink passes two variables Name and Emailadress. The problem is that only the first variable Name show up in the...
1
by: Joris De Groote | last post by:
I can send a mail, no problem, however, the sended mail always comes from the e-mail adres from the sender I use this code myMessage = New MailMessage With myMessage ..To = ontvanger
1
by: salad | last post by:
I can store in a a hyperlink like this ClickMe#http://www.test.com in Access ClickMe is the display text, http://www.test.com the address. Is it possible, using SendObject, to send this...
3
by: PYG | last post by:
Hi everybody I have a simple question : If i use this code : <body style="font-size:24px;color:blue;"> Text in body <table> <tr><td> Text in table
19
by: david.karr | last post by:
If in my CSS I set the "background-color" property on the "body" element, it only covers the background of the elements defined in the body, up to the current width and height of the page. However,...
6
semanticnotion
by: semanticnotion | last post by:
Hi sir i want to transform the data of one table into another through foreign key but the following error come to my browser Here is my code and data base structure. CREATE TABLE IF NOT...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.