Sending webpage through email I've implemented hook_menu and in page callback there is a function in my module which retrieves some records randomly and theme them with theme_table. Now I want a button on the page for sending this page exactly as it is to a predefined email address without refreshing the page because of randomly selected records. 

I placed a button through simple HTML code but don't know how I can implement it's onClick function. Or is there any better way to do that? Thanks
It is simple javascript... The returned value can easilly be sent through ajax (there are good tutorials on sending mails with ajax).

&lt;button onClick="alert(document.getElementsByTagName('body').innerHTML())" value="serialize"&gt;


You might run into trouble though, at first email clients can have trouble accessing images from remote locations (eg. from your own url). So you might have to attach them to the mail.

Also most email clients are very picky when it comes to css. They refuse to load a remote sytlesheet. You will have to hardcode all css classes in the respective elements, the old fashioned way... By using the object style attribute.

&lt;body style="background: red; font-size: 9pt;"&gt;


So as you see it is harder then just sending the HTML to an email receipient. In fact you might want to have a look at HTML2Canvas (or other alternatives) to make a 'screenshot' of a webpage and just send one image.