通过javascript发送网页

[英]Send a web page through javascript


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.

我想通过javascript向网页发送电子邮件。它足以打开outlook新邮件选项。我尝试移动一个这里我在html中使用mailto:选项。实际上我正在尝试创建一个动态电子邮件模板,并希望以html格式发送该模板。

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

它显示错误“注释行参数无效。验证您正在使用的开关”请给我解决方案。

4 个解决方案

#1


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

Javascript无法发送电子邮件。您最好的选择是给我发送电子邮件语法。大多数浏览器都支持一种约定,它允许您设置各种属性的内容。

<a href="mailto:foo@bar.com?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.

它必须是URL编码,据我所知,没有可靠的方法来传递HTML。您必须假设纯文本电子邮件。

#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.

1)让服务器向生成所需HTML的页面发出XMLHTTP请求。抓住它,使其成为邮件正文。

  • 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.

2)抓住innerHTML,将其粘贴在隐藏的textarea中并将其发布回服务器。使用邮件正文中的已发布表单字段。

#3


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.

你需要做这个服务器端,而不是客户端。 Outlook不会允许您使用模板所需的控件。并且有充分理由 - 您不希望网站控制您的Outlook并发送电子邮件。

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

如果您可以告诉我们您使用的服务器,我们可以向您展示如何发送电子邮件服务器端。

#4


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.

有安全限制阻止它直接工作。是的,如果你特别想要Outlook,你可能会开始搞乱ActiveX - 但这很繁琐并且限制了某些操作系统,安装和安全设置。

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

使用mailto:URL要好得多。这是跨平台的,并支持任何默认邮件客户端。

智能推荐

注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:http://www.itdaan.com/blog/2009/03/30/33bf0884dd6cceb698b003f3c2a0b3c4.html



 
© 2014-2019 ITdaan.com 粤ICP备14056181号  

赞助商广告