Link to home
Start Free TrialLog in
Avatar of dmrussell12345
dmrussell12345

asked on

Send HTML page as Email...

When you have a web page open in Internet Explorer, you can select File / Send / Page by Email and it will allow you to send the page as an html email.  

My question is... is there a simple code that will allow me to place a button on the page that will do this exact same thing?  Basically, I want a button that reads "Click Here to email this page".  When the button is clicked, it does the same command as File / Send / Page by.

Hopefully this makes sense.

Avatar of knightlycomputing
knightlycomputing
Flag of United States of America image

So you want the email to actually be the HTML?  I would recommend instead just emailing them a link to the web page.  You can do that by using this code:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script language="javascript">
function mailpage()
{
mail_str = "mailto:?subject=Check out this web page.";
mail_str += "&body=I thought you might be interested in this web page.";
mail_str += ". You can view it at, " + "http://helmuti-pdorf.wikidot.com/mail-test";
location.href = mail_str;
}
</script>
</head>

<body>
<a href="javascript:mailpage()">Click here</a> to email this page ("http://helmuti-pdorf.wikidot.com/mail-test")to a friend.
</body>
</html>

Open in new window


Source: http://community.wikidot.com/wishlist:36

Play with that code a bit and see if that's what you are wanting it to do.  Be sure to change the URL's match the page you want to be able to link to.
Avatar of dmrussell12345
dmrussell12345

ASKER

I would rather email the page as the body of the email and not a link.

Open a web page in Internet Explorer.  Then select File / Send / Page by Email.  It will open an email screen with the web page as the body of the email.  Some web pages will not look as great as other, but you'll get the idea.

The web pages I set up with this button will be formatted so they will easily be emailed in a nice format.
Are you restricted to just HTML and Javascript or can you use a server-side language like PHP or ASP.NET?  I'm not aware of a way to do that with Javascript (though there are much smarter Javascript Guru's out there), but I'm sure I could come up with a server-side script to do it.
I could use php.
Well, I'm stumped.  I have to retract my last statement.  I don't know of a way to add html text as the body of the email in a mailto: link.

Basically you want to open up a new outlook (or outlook express) email message and specify the body of the email to be html and and have it render the html (instead of just sending the html text).

The only way I know of to open a new Outlook message is to use a mailto: link, but they don't support HTML text (just plain text).  And I don't know of a way to initiate IE's internal function to send the page as an email.

Sorry.
ASKER CERTIFIED SOLUTION
Avatar of manlimnag
manlimnag
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The issue I see with this is #4 - 7.  I was my understanding he wanted it to open up in an email client such as Outlook or Outlook Express.  Sure you can send HTML email via the mail() function in PHP, but I didn't think that's what he wanted.
Huh!  Apparently I was to late and this was what the OP wanted.  Sorry I didn't get you what you wanted.