Setting email using mailto

T

tshad

I am trying to put an persons email address in a response I am sending
another person.

I can get it to work by doing the following:

message.Body = resumeTop & vbCrLf & vbCrLf & "For Applicant: " &
session("firstName") & " " & session("lastName") & vbCrLf & "Email:
mailto:" & session("email") & vbCrLf & vbCrLf & resumeBottom

When the email gets to the person, the email link works. The problem is
that the "mailto:" also shows in outlook (mailto:[email protected]). What I want
it to show is (e-mail address removed) and bring up the email client.

How is that done?

Thanks,

Tom.
 
R

Ray Costanzo [MVP]

Some mail clients will automagically "linkify" an e-mail address. For
example, in your post, (e-mail address removed) is a link for me in Outlook Express. If
you wanted to be certain, you'd have to generate an html e-mail and use "<a
href=""mailto:" & session("email") & """>" & session("email") & "</a>."
But, if the e-mail client supports html e-mail, there's a damn good chance
it will also automagically make (e-mail address removed) into a link without your having
to put a mailto: in front of it.

Ray at work
 
T

tshad

Ray Costanzo said:
Some mail clients will automagically "linkify" an e-mail address. For
example, in your post, (e-mail address removed) is a link for me in Outlook Express.
If
you wanted to be certain, you'd have to generate an html e-mail and use
"<a
href=""mailto:" & session("email") & """>" & session("email") & "</a>."
But, if the e-mail client supports html e-mail, there's a damn good chance
it will also automagically make (e-mail address removed) into a link without your
having
to put a mailto: in front of it.

I tried you your href and it didn't even give me a link. I've had this
trouble before and am not sure what is causing it. When I use your line, I
get:

a href="mailto:[email protected]">[email protected]</a>

but no link.

Am I missing something?

Thanks,

Tom
 
R

Ray Costanzo [MVP]

I tried you your href and it didn't even give me a link. I've had this
trouble before and am not sure what is causing it. When I use your line,
I get:

a href="mailto:[email protected]">[email protected]</a>

Well, for one thing, you forgot the < before the a href=... But is your
e-mail in plain text or HTML? Can you show the code snippet that you're
using to create and send the e-mail?

Ray at work
 
D

Daniel M. Hendricks

AFAIK, the only way to do it is with an HTML-formatted e-mail:
<a href="mailto:[email protected]">[email protected]</a>

You'd have to change the message format though for it to render
correctly in the e-mail client:
message.BodyFormat = MailFormat.Html

See 'Sending HTML E-mail'
http://www.aspheute.com/english/20000918.asp

I am trying to put an persons email address in a response I am sending
another person.

I can get it to work by doing the following:

message.Body = resumeTop & vbCrLf & vbCrLf & "For Applicant: " &
session("firstName") & " " & session("lastName") & vbCrLf & "Email:
mailto:" & session("email") & vbCrLf & vbCrLf & resumeBottom

When the email gets to the person, the email link works. The problem is
that the "mailto:" also shows in outlook (mailto:[email protected]). What I want
it to show is (e-mail address removed) and bring up the email client.

How is that done?

Thanks,

Tom.

Daniel M. Hendricks
http://www.danhendricks.com
 
D

Daniel M. Hendricks

AFAIK, the only way to do it is with an HTML-formatted e-mail:
<a href="mailto:[email protected]">[email protected]</a>

You'd have to change the message format though for it to render
correctly in the e-mail client:
message.BodyFormat = MailFormat.Html

See 'Sending HTML E-mail'
http://www.aspheute.com/english/20000918.asp

I am trying to put an persons email address in a response I am sending
another person.

I can get it to work by doing the following:

message.Body = resumeTop & vbCrLf & vbCrLf & "For Applicant: " &
session("firstName") & " " & session("lastName") & vbCrLf & "Email:
mailto:" & session("email") & vbCrLf & vbCrLf & resumeBottom

When the email gets to the person, the email link works. The problem is
that the "mailto:" also shows in outlook (mailto:[email protected]). What I want
it to show is (e-mail address removed) and bring up the email client.

How is that done?

Thanks,

Tom.

Daniel M. Hendricks
http://www.danhendricks.com
 
D

Daniel M. Hendricks

AFAIK, the only way to do it is with an HTML-formatted e-mail:
<a href="mailto:[email protected]">[email protected]</a>

You'd have to change the message format though for it to render
correctly in the e-mail client:
message.BodyFormat = MailFormat.Html

See 'Sending HTML E-mail'
http://www.aspheute.com/english/20000918.asp

I am trying to put an persons email address in a response I am sending
another person.

I can get it to work by doing the following:

message.Body = resumeTop & vbCrLf & vbCrLf & "For Applicant: " &
session("firstName") & " " & session("lastName") & vbCrLf & "Email:
mailto:" & session("email") & vbCrLf & vbCrLf & resumeBottom

When the email gets to the person, the email link works. The problem is
that the "mailto:" also shows in outlook (mailto:[email protected]). What I want
it to show is (e-mail address removed) and bring up the email client.

How is that done?

Thanks,

Tom.

Daniel M. Hendricks
http://www.danhendricks.com
 
D

Daniel M. Hendricks

AFAIK, the only way to do it is with an HTML-formatted e-mail:
<a href="mailto:[email protected]">[email protected]</a>

You'd have to change the message format though for it to render
correctly in the e-mail client:
message.BodyFormat = MailFormat.Html

See 'Sending HTML E-mail'
http://www.aspheute.com/english/20000918.asp

I am trying to put an persons email address in a response I am sending
another person.

I can get it to work by doing the following:

message.Body = resumeTop & vbCrLf & vbCrLf & "For Applicant: " &
session("firstName") & " " & session("lastName") & vbCrLf & "Email:
mailto:" & session("email") & vbCrLf & vbCrLf & resumeBottom

When the email gets to the person, the email link works. The problem is
that the "mailto:" also shows in outlook (mailto:[email protected]). What I want
it to show is (e-mail address removed) and bring up the email client.

How is that done?

Thanks,

Tom.

Daniel M. Hendricks
http://www.danhendricks.com
 
D

Daniel M. Hendricks

AFAIK, the only way to do it is with an HTML-formatted e-mail:
<a href="mailto:[email protected]">[email protected]</a>

You'd have to change the message format though for it to render
correctly in the e-mail client:
message.BodyFormat = MailFormat.Html

See 'Sending HTML E-mail'
http://www.aspheute.com/english/20000918.asp

I am trying to put an persons email address in a response I am sending
another person.

I can get it to work by doing the following:

message.Body = resumeTop & vbCrLf & vbCrLf & "For Applicant: " &
session("firstName") & " " & session("lastName") & vbCrLf & "Email:
mailto:" & session("email") & vbCrLf & vbCrLf & resumeBottom

When the email gets to the person, the email link works. The problem is
that the "mailto:" also shows in outlook (mailto:[email protected]). What I want
it to show is (e-mail address removed) and bring up the email client.

How is that done?

Thanks,

Tom.

Daniel M. Hendricks
http://www.danhendricks.com
 
D

Daniel M. Hendricks

AFAIK, the only way to do it is with an HTML-formatted e-mail:
<a href="mailto:[email protected]">[email protected]</a>

You'd have to change the message format though for it to render
correctly in the e-mail client:
message.BodyFormat = MailFormat.Html

See 'Sending HTML E-mail'
http://www.aspheute.com/english/20000918.asp

I am trying to put an persons email address in a response I am sending
another person.

I can get it to work by doing the following:

message.Body = resumeTop & vbCrLf & vbCrLf & "For Applicant: " &
session("firstName") & " " & session("lastName") & vbCrLf & "Email:
mailto:" & session("email") & vbCrLf & vbCrLf & resumeBottom

When the email gets to the person, the email link works. The problem is
that the "mailto:" also shows in outlook (mailto:[email protected]). What I want
it to show is (e-mail address removed) and bring up the email client.

How is that done?

Thanks,

Tom.

Daniel M. Hendricks
http://www.danhendricks.com
 
T

tshad

Ray Costanzo said:
Well, for one thing, you forgot the < before the a href=... But is your
e-mail in plain text or HTML? Can you show the code snippet that you're
using to create and send the e-mail?

Here is the code snippet I am using:

Dim Message As New MailMessage()
message.From = webMasterEmail
message.To = webMasterEmail
message.Subject = screenTestSubject
message.Body = "For Applicant: " & "<a
href='http://www.ftsolutions.com/login" & session("firstName") & " " &
session("lastName") & "</a>" & vbCrLf
message.Body = message.Body & "Email: <a href=""mailto:" &
session("email") & """>" & session("email") & "</a>." & vbCrLf & vbCrLf
SmtpMail.SmtpServer = mailServer
smtpMail.Send(message)

This gets me the following email - no link for either the normal href or the
mailto:

For Applicant: <a href='http://www.ftsolutions.com/loginThomas
Scheiderich</a>
Email: <a href="mailto:[email protected]">[email protected]</a>.

Thanks,

Tom
 
D

Daniel M. Hendricks

T

tshad

Daniel M. Hendricks said:
You need to set your mail format as HTML:
message.BodyFormat = MailFormat.Html

That did it.

I was surprised it work as I was not setting up a normal HTML page, just
some HTML elements.

Do I need to anything different if I am setting up a total HTML page? I
assume I wouldn't use CSS for an HTML I am sending in an email - right?

Thanks,

Tom
See 'Sending HTML E-mail'
http://www.aspheute.com/english/20000918.asp

Well, for one thing, you forgot the < before the a href=... But is your
e-mail in plain text or HTML? Can you show the code snippet that you're
using to create and send the e-mail?

Here is the code snippet I am using:

[snip]

Daniel M. Hendricks
http://www.danhendricks.com
 
T

tshad

Also, when I use the MailFormat.Html, I found that my vbCrLf doesn't work.
Do I need to use <br> instead to make it work because of the HTML
formatting?

Tom

tshad said:
Daniel M. Hendricks said:
You need to set your mail format as HTML:
message.BodyFormat = MailFormat.Html

That did it.

I was surprised it work as I was not setting up a normal HTML page, just
some HTML elements.

Do I need to anything different if I am setting up a total HTML page? I
assume I wouldn't use CSS for an HTML I am sending in an email - right?

Thanks,

Tom
See 'Sending HTML E-mail'
http://www.aspheute.com/english/20000918.asp

Well, for one thing, you forgot the < before the a href=... But is your
e-mail in plain text or HTML? Can you show the code snippet that you're
using to create and send the e-mail?

Here is the code snippet I am using:

[snip]

Daniel M. Hendricks
http://www.danhendricks.com
 
T

tshad

Also,
if I use the MailFormat.Html, the text I got from one of my fields which is
of type text and has linefeeds in them, does not display them correctly.

How do I go about handling these linefeeds? The field is a freeform field
that the client can put in some text and needs to be displayed how they put
it in.

Thanks,

Tom.

tshad said:
Also, when I use the MailFormat.Html, I found that my vbCrLf doesn't work.
Do I need to use <br> instead to make it work because of the HTML
formatting?

Tom

tshad said:
Daniel M. Hendricks said:
You need to set your mail format as HTML:
message.BodyFormat = MailFormat.Html

That did it.

I was surprised it work as I was not setting up a normal HTML page, just
some HTML elements.

Do I need to anything different if I am setting up a total HTML page? I
assume I wouldn't use CSS for an HTML I am sending in an email - right?

Thanks,

Tom
See 'Sending HTML E-mail'
http://www.aspheute.com/english/20000918.asp


Well, for one thing, you forgot the < before the a href=... But is
your
e-mail in plain text or HTML? Can you show the code snippet that
you're
using to create and send the e-mail?

Here is the code snippet I am using:

[snip]

Daniel M. Hendricks
http://www.danhendricks.com
 
R

Ray Costanzo [MVP]

Yes, when you use HTML format, you have to then use HTML just like you would
in a .htm file. vbCrLf will do nothing but put a cr+lf in the ~source~ of
the HTML body, just as it would in any other HTML document. Just send plain
text and be done with it. If someone doesn't see (e-mail address removed) as a link
in his mail client, that is what the person is used to seeing anyway.

Ray at work
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top