1

i have a php page that sends mails to the visitors and in the body of the mail there is an email address which turns into a link and has an underline. this link should be just an address not a link to send a mail to it. another thing is that i can't change it's style using CSS or Something else. i have the same problem with phone numbers. i don't want it to be a link. how can i disable this link behavior?

this is the code for sending the email:

$mail = "getter@example.com";
$subject = "mail address";
$body = "<p>This is The Email Address</p><br><span>responder@example.com</span>";
$headers = "From: Gifters <info@example.com>"
mail($mail, $subject, $body, $headers);

thanks for reading this.

Hossein MK
  • 23
  • 5
  • Edit: I understand you're question, answering now. – Nicolas Jul 07 '14 at 13:12
  • 1
    @Nicolas I believe he wants to display the email address in plain text without it becoming parsed into a hyperlink. – eluong Jul 07 '14 at 13:13
  • possible duplicate of [Prevent gmail to create link for URL and email](http://stackoverflow.com/questions/11988534/prevent-gmail-to-create-link-for-url-and-email) – dwitvliet Jul 07 '14 at 13:13
  • 1
    Try testing this with different email services. What you're describing sounds like something that may be caused by the email service parsing the email before being presented to the viewer, and making things like phone numbers and email addresses clickable. HTML doesn't have anything "special" regarding phone numbers, but you may have a Skype extension in your web browser that changes it to a Skype link, for example. – Joe Majewski Jul 07 '14 at 13:16
  • To add onto what Joe said, making stuff links that probably should be helps people who may not use the mouse. – Ryan B Jul 07 '14 at 13:22

4 Answers4

1

A lot of e-mail clients transform telephone numbers, email addresses, ... automatically into links.

You could try and avoid these filters by using & instead of @

but then agian, why is this bad? Everything to make it easier for the user is a good thing, no?

Pinoniq
  • 1,365
  • 9
  • 13
0

One solution to this is add CSS to your email's surrounding tags that way you can remove the pointer cursor and underline:

$mail = "getter@example.com";
$subject = "mail address";
$body = "<p>This is The Email Address</p><br><span class='nonLink'>responder@example.com</span>";
$headers = "From: Gifters <info@example.com>"
mail($mail, $subject, $body, $headers);

<style>
    .nonLink {
         text-decoration: none;
         pointer-events: none;
         cursor: default;
    }
</style>

You could also put your CSS directly in-line with the HTML, however, this is bad practice.

text-decoration: none; will remove your underline and (blue?) color

pointer-events: none; will remove your hyperlink

cursor: default; will bring back the default cursor

Nicolas
  • 1,125
  • 1
  • 15
  • 31
0

You could wrap the email in empty tags and hope that the mail clients are not smart enough to see through it:

$body = "<p>This is The Email Address</p><br /><span>responder</span><span>@</span><span>example.</span><span>.com</span>";
imbondbaby
  • 6,351
  • 3
  • 21
  • 54
0

Have you tried to use the html code equivalent of @ which is &#64; ?

Not sure if it will work :

$body = "<p>This is The Email Address</p><br><span>responder&#64;example.com</span>";
singe3
  • 2,065
  • 4
  • 30
  • 48