www.webdeveloper.com
Results 1 to 3 of 3

Thread: Email Subject Line Code

Hybrid View

  1. #1
    Join Date
    Aug 2012
    Location
    Abington, MA
    Posts
    2

    Post Email Subject Line Code

    I have a web site and on each page I have email contact links (Tech Support, Contact Me, etc). What I want to do is when the end user clicks on the link, the email subject line will display a concatenated string that includes the page title.

    I know I can hard code the subject line with the page title (without concatenating anything):
    <a href="techsupport:contactme@example.com?subject="Technical Issue With Poetry Page">Tech Support</a>

    But I don't want to hard code each of the links on every page. Is there a way to concatenate using the Title tag? Would I use StringBuilder? If so, what is the correct syntax?

    I am currently using Dreamweaver to develop my site.

  2. #2
    Join Date
    Aug 2012
    Location
    Abington, MA
    Posts
    2
    Is there a different language I should use for this?

  3. #3
    Join Date
    Jun 2006
    Location
    Boston, MA
    Posts
    383
    php would be easiest.. otherwise this might work for you.

    HTML Code:
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>mailto with location</title>
    </head>
    <body>
    <p>Welcome. 
    <script type="text/javascript">
    var subj = encodeURI("Have a look at this:-  " + window.location.href);
    var body = encodeURI("You might find this interesting:- ") + "&#37;0A%0A" + encodeURI(window.location.href);
    document.write("<a href=\"mailto:?subject=" + subj + "&amp;body=" + body + "\">Send link to a friend</a>");
    </script>
    <noscript>You do not have Javascript enabled so you cannot send the message.</noscript>
    </p>
    </body>
    </html>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles