2

I want to email a web page through javascript. Its enough to open the outlook new mail option. I try to move a Here i am using mailto: option in html. Actually i am try to create a dynamic email template and want to send that template in html format.

Its showing error "comment line argument is not valid. verify the switch you are using" please get me the solution.

2
  • Praveen, this is not nearly enough information for us to be able to help you out. Can you show us what you've got so far? Commented Mar 30, 2009 at 15:25
  • Actually, i need to create a email template. I want to send the email template in the HTML formate. (such as sending the company add ect.,) Commented Mar 31, 2009 at 6:32

4 Answers 4

6

Javascript can't send e-mails. Your best bet is the <a href="mailto:[email protected]">e-mail me</a> syntax. There is a convention that most browsers suppors that lets you set the contents of various attributes as well.

<a href="mailto:[email protected]?subject=Hi&body=hello%2C+there%21">e-mail me</a>

It will have to be URL encoded, and as far as I know, there is no reliable way to pass HTML. You have to assume plain text emails.

Sign up to request clarification or add additional context in comments.

Comments

2

You really need the server's help to make this easier.

1) Have the server make an XMLHTTP request to the page that generates the HTML you want. Grab it and make it the mail body.

  • or -

2) Grab the innerHTML, stick it in a hidden textarea and post it back to the server. Use the posted form field in the mail body.

Comments

1

You need to do this server-side, not client side. Outlook is not going to allow you the control you need to use a template. And for good reason - you wouldn't want websites taking control over your Outlook and sending emails.

If you can tell us what server you're using, we can show you how to send the email server-side.

Comments

0

There are security restrictions which stop it working directly. Yes if you wanted Outlook specifically, you could start messing with ActiveX - but that is fiddly and limited certain operating systems , installations, and security settings.

It is much better to use a mailto: URL. This is then cross-platform, and supports any default mail client.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.