SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Zealot
    Join Date
    Sep 2010
    Posts
    131
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    HTML button on an email page

    I was wondering if it is possible to put a html button on an email page that would when clicked send you to a website: www.mysite.com.

    Code:
    msg.[To].Add(email1)
    msg.Subject = "Welcome Session Member"
    msg.From = fromAdd
    msg.IsBodyHtml = True
    msg.Priority = MailPriority.Normal
    msg.BodyEncoding = Encoding.Default
    msg.body="<input id="Button1" type="button" value="Website" onclick=somefunction("www.mysite.com") />"
    or something like this..
    Last edited by ralph.m; Dec 20, 2013 at 07:31.

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,207
    Mentioned
    456 Post(s)
    Tagged
    8 Thread(s)
    Your question isn't all that clear. Are just just trying to place a link in an email?

  3. #3
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,189
    Mentioned
    191 Post(s)
    Tagged
    2 Thread(s)
    I don't think I would trust all email clients to handle form submits or javascript as a web page would.

    You can put links though. So I suppose you could link around an image of a button.

    But if the user is taken out of their email window unexpectedly they might get a bit miffed.

  4. #4
    SitePoint Evangelist silver trophybronze trophy
    Join Date
    Jul 2013
    Posts
    406
    Mentioned
    22 Post(s)
    Tagged
    0 Thread(s)
    I think the question is: a link with the appearance of a button, like a submit button in a html page.

    The type="button" of a html element is for use in a html-browser. But not all email visitors use "browser-mail" (as Google-mail), some use e-mail programs (like Outlook, Thunderbird). E-mail programs aren't browsers, and have a bad html support.

    Often the e-mail client doesn't show images, so I think an image-button is not reliable.

    You can try a "Bulletproof Email Button", or the "How to make HTML email buttons that rock", which has the same principle: an old-fashioned table model with a styled link in a cell.

    If you follow them with a more html button-like design, you'll get something like this:


  5. #5
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,189
    Mentioned
    191 Post(s)
    Tagged
    2 Thread(s)
    Excellent point about email clients and images. Mine only initially blocks images for emails not in my whitelist, but there's no accounting for others.

    I like the CSS solution a lot. Do you know if the email client doesn't support "border-radius" if it would show OK except without the "rounded corners"?

  6. #6
    SitePoint Evangelist silver trophybronze trophy
    Join Date
    Jul 2013
    Posts
    406
    Mentioned
    22 Post(s)
    Tagged
    0 Thread(s)
    I don't know for sure what e-mail clients are doing, but the css rule is that if something is not supported, it will be denied (just like an error).
    So I should trust that the fall back is rectangle corners.
    But a live check is never for nothing.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •