Last post Sep 21, 2013 07:32 AM by Afzaal.Ahmad.Zeeshan
Sep 20, 2013 03:57 PM|Afzaal.Ahmad.Zeeshan|LINK
Hi, I am using email service by Gmail to send emails to clients when password change occurs.
What code I am using to send email is this:
subject: "Password changed for your account",
body: @"Hello " + name + @".<br>
The account password for your account: " + WebSecurity.CurrentUserName + @" was changed. We're glad you're back in business for your account.<br><br>
If this change was made by you, then its fine and you can skip this mail.<br> But if this change was not made by you, then you might want to change your password to make your account more secure as there might be someone else, playing with your account.<br><br> Please login your account
<a href='localhost:5878/login' target='_blank'>here</a>.
<div style='margin-top: 10px; font-size: .8em; color: #999;'>
Hi, this email was sent to: " + WebSecurity.CurrentUserName + @". This email was sent to you, because your account's security is a major priority for us. If this email is recieved in error. Please let us know here: <a href='localhost:5878/contact' target='_blank'>Contact Us</a>.
This way, the email is sent to user.
But the issue is that the email contains the hyperlinks as just texts but wrapped inside
Like the above one. Here:
You can see, there is no href included in the code for email and so there is no link in the email body! Why is it so? Every text is sent as is it. But not this one! Only the issue comes up with these two of the codes. (Two of the hyperlinks).
Sep 20, 2013 04:03 PM|AZMatt|LINK
You need to add isBodyHtml: true
Sep 20, 2013 04:05 PM|Afzaal.Ahmad.Zeeshan|LINK
I have tried that!
Sep 20, 2013 05:59 PM|AZMatt|LINK
Then you might want to try adding the rest of the tags like <html>, <head>, and <body>.
Sep 20, 2013 06:03 PM|Afzaal.Ahmad.Zeeshan|LINK
Well, I tried this! But these tags were removed by Gmail. And I got the same thing. Same error!
Sep 20, 2013 06:04 PM|AZMatt|LINK
Have you marked this email as a Safe Sender?
Sep 20, 2013 06:18 PM|Afzaal.Ahmad.Zeeshan|LINK
Yes, it is! The only issue is with the hyperlinks. :/ All other coding is good. The style for the last div is also perfect!
Sep 20, 2013 08:09 PM|AZMatt|LINK
Sorry, I don't have a GMail account that I can use to reproduce the error. My last suggestion would be to try adding http:// to the hyperlink. If that doesn't work I will back out and let somebody else try to help you.
Sep 21, 2013 07:32 AM|Afzaal.Ahmad.Zeeshan|LINK
Bravo buddy! That worked. :) Thanks alot man... ^_^