Reputation: 8697
I'm trying to do a password recovery with SMTP. In the email, i've added some necessary text and hyperlink for the user to recover their password. As you can see the code here, i've added a hyper link.
strBody.Append("<a href=**destination url** emailId=" + txtEmailId.Text + "&uName=" + txtnric.Text + "&uCode=" + uniqueCode + ">Click here to change your password.</a>");
In order to add a non-hyperlink text, i added this statement behind the code.
strBody.Append("<a href=**destination url** emailId=" + txtEmailId.Text + "&uName=" + txtnric.Text + "&uCode=" + uniqueCode + ">Click here to change your password.</a> \t\t\t\t This is a computer generated email for your password recovery. \t\t please do not reply this email.");
I've added a \t in the string but instead it doesn't show any tab spacing in the email. What have i done wrong here?
Upvotes: 3
Views: 5521
Reputation: 8680
Tab characters inside <pre></pre>
tags seem to survive.
I have not tried this in an e-mail yet, but you can give it a shot.
<pre>
a b c d
</pre>
Upvotes: 1
Reputation: 26209
use
multiple times instead of tabs in your html message body.
Upvotes: 2
Reputation: 534
You're probably sending the email as HTML, therefore the tab (\t) will be rendered as a single space, which is normal.
Either change the email format normal (plain text) or add styling to mimic the indentation you want.
Upvotes: 0
Reputation: 67898
There are no tabs in HTML. That \t
is a Windows character code. You'll need to either throw a <span style="margin-left: 1em;">
around the text or use
(many times).
I think the right approach is this:
<span style=\"margin-left: 1em;\">This is a computer generated email for your password recovery.</span>
Upvotes: 2
Reputation: 27609
The fact that you have HTML in your body makes me assume that you are sending HTML emails. If this is the case then your tabs will be in the source but HTML collapses all whitespace which includes tabs.
You'll have to either use proper HTML to indent your text (eg margins on block elements) or use plain text where tabs and such like will work.
Upvotes: 2