简体   繁体   English

使用JavaScript在HTA中发送电子邮件并隐藏发件人的电子邮件地址

[英]Send email in HTA using JavaScript and hide the sender's email address

I'm using an HTA at work with many options, now I'm trying to add a page that allows you to send an email directly from the HTA without opening MS Outlook. 我正在使用带有许多选项的HTA,现在我试图添加一个页面,该页面允许您直接从HTA发送电子邮件而无需打开MS Outlook。

I'm using Outlook 2003. I tried two ways to create the email sending page: 我使用的是Outlook2003。我尝试了两种方法来创建电子邮件发送页面:

1. Using Outlook.Application ActiveX Object - It didn't work because its seems to work only with Outlook 2007, So meanwhile I left it out of the question. 1.使用Outlook.Application ActiveX对象-它无法工作,因为它似乎仅适用于Outlook 2007,因此我将其排除在外。

2. Using simple HTML with 'mailto:' - It is working fine to send simple Emails, but I have a problem that I'm not able to solve. 2.将简单的HTML与“ mailto:”一起使用-发送简单的电子邮件可以很好地工作,但是我有一个无法解决的问题。

In Outlook I can send emails from a 'fake' address called ' Service Mail ' ( I just write it in the 'From' field ) so customers won't be able to reply to my emails. 在Outlook中,我可以从称为“ 服务邮件 ”的“伪造”地址发送电子邮件(我只是在“发件人”字段中写出),因此客户将无法回复我的电子邮件。 I want to do it also in my HTA page, but I think this option doesn't exist. 我也想在我的HTA页面中执行此操作,但是我认为此选项不存在。

Is there any way doing it? 有什么办法吗? Maybe by using an ActiveX Object for outlook 2003 and do it with that object? 也许通过将ActiveX对象用于Outlook 2003并将其与该对象一起使用?

Important: I can only use client side languages, because I don't have a server. 重要提示:因为我没有服务器,所以只能使用客户端语言。

Thanks, Rotem 谢谢,Rotem

I've made a HTA in VBScript that sends email. 我已经在VBScript中制作了可以发送电子邮件的HTA。 It connects directly to the mail server. 它直接连接到邮件服务器。 You don't need Outlook (or any other email client) installed so it's pretty useful. 您不需要安装Outlook(或任何其他电子邮件客户端),因此它非常有用。 Use something like this: 使用这样的东西:

With CreateObject("CDO.Message")
  .Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.server.com"
  .Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing")  = 2
  .Subject  = "The subject line"
  .To       = "recipient@email.com"
  .From     = "sender@email.com"
  .TextBody = "The body of the email"
  ' or .CreateHTMLbody "page.htm"
  .AddAttachment "C:\path\to\file.txt"
  .Send
End With

... you get the idea. ...你明白了。

Edit: Just saw this request was specifically for javascript, but it's essentially the same: 编辑:刚刚看到此请求是专门针对javascript,但本质上是相同的:

var mailobj = Server.CreateObject("CDO.Message");
mailobj.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.server.com";
mailobj.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing")  = 2;
mailobj.Subject  = "The subject line";
mailobj.To       = "recipient@email.com";
mailobj.From     = "sender@email.com";
mailobj.TextBody = "The body of the email";
mailobj.Configuration.Fields.Update();
mailobj.Send();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM