将当前网页作为邮件发送给其他人 [英] send current webpage as mail to other person

查看:113
本文介绍了将当前网页作为邮件发送给其他人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,

实际上,我正在使用jsp servlet开发Web应用程序.和数据库mysql.

我已经开发了一个jsp页面,其中包含来自mysql数据库的数据.

我已经配置了可以发送邮件的java邮件系统.

每当查看该页面的用户.如果他想将该页面作为电子邮件发送给他的朋友或任何他想要的人.

现在,我想通过电子邮件将该jsp页面(整个页面而不是该页面的链接)发送到用户提供的任何电子邮件id.

我怎么能实现这个想法或任何代码会更有用.

在此先感谢.....

问候,
mike ...

Dear all,

Actually I am developing an web application using jsp servlets. and database mysql.

I have developed an jsp page which contains data which comes from mysql database.

I have configured java mail system which can send mails.

whenever a user who views that page. if he wants to send that page as email to his friend or whoever he wants.

Now I want to send that jsp page(Entire Page but not that page''s link) in email to any email id which user provides.

how can i achieve this any idea or any code will be more helpful.

Thanks in advance.....

Regards,
mike...

推荐答案

我在您的站点上放置了一个按钮,当单击该按钮时,它会在JSP页面中对发送邮件功能进行AJAX调用,并通过document.body.innerHTML作为电子邮件的正文.
如果您希望将图像包含在电子邮件中,而不是由电子邮件客户端下载,则有点棘手,最好避免,尽管我认为这是可行的.

可以在以下位置找到有关如何使用JSP发送邮件的详细信息: http://kb.hyve.com/wiki/SendHTMLEmailInJSP [< ^ ]

这里的AJAX/JSP示例: http://www.ajaxprojects.com/ajax/tutorialdetails.php?itemid= 580 [^ ]

在此处将图像嵌入电子邮件中(即使您不是EE成员,也请滚动至末尾以查看解决方案):http://www.experts-exchange.com/Programming/Languages/Java/J2EE/JSP/Q_21004301.html [
I''d put a button on your site which when clicked makes an AJAX call to a send mail function in a JSP page, passing the document.body.innerHTML as the body for the email.
If you want the images to be included in the email, rather than downloaded by the email client, that''s a bit trickier and probably best avoided, though I believe it would be doable.

Details on how to send a mail using JSP can be found here: http://kb.hyve.com/wiki/SendHTMLEmailInJSP[^]

AJAX / JSP Example here: http://www.ajaxprojects.com/ajax/tutorialdetails.php?itemid=580[^]

Embedding images in email here (scroll to the end to see the solution, even if your not an EE member): http://www.experts-exchange.com/Programming/Languages/Java/J2EE/JSP/Q_21004301.html[^]

====Update====
If you''re sending a different page to the one you''re using to request that an email be sent, use an AJAX call to pull down the page to send as XML, then select the body node''s contents in place of of document.body.innerHTML from the solution above.


在服务器端,获取电子邮件地址并为页面创建HTML,以将其插入到邮件文档中. br/> 我猜想这有一个问题,就是您被卡住了,因此为了使事情变得更容易,请尝试一下,让我们知道您被卡住了.
On the server side, pick up the e-mail address and create your HTML for the page to insert into the mail document.
I''m guessing that there is a point on this were you are getting stuck, so to make things easier, try this and let us know where you get stuck.


这篇关于将当前网页作为邮件发送给其他人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆