简体   繁体   English

通过javascript发送Outlook邮件

[英]Send Outlook mail via javascript

The title may not be 100% on point. 标题可能不正确。

At the place where I work, we have to send mails sometimes, to certain adresses (there are 5 of them). 在我工作的地方,有时我们必须将邮件发送到某些地址(其中有5个)。

Anyway, I created a batch script that lets you enter some details of the mail you have to send then the batch script executes a: 无论如何,我创建了一个批处理脚本,可让您输入一些必须发送的邮件的详细信息,然后该批处理脚本执行以下操作:

outlook.exe /c ipm.note /m "mail@address.com&cc=mail@address2.com&subject=SUBJECT&body=BODY"

This opens a new mail Outlook window as some of you may know already. 某些人可能已经知道,这将打开一个新的Outlook邮件窗口。

The "problem" (because it's not really a big problem) is that I have to add my signature manually because there is no switch for Outlook to do that. “问题”(因为这不是一个大问题)是我必须手动添加我的签名,因为没有开关可以让Outlook做到这一点。

Now, I got my hand on a .js script (from a simple html page, with a css, done by someone for the exact same reason, that being to just input some details about the mail, etc) that opens a new mail Outlook window by using something like: 现在,我手把手放在一个.js脚本上(从一个简单的HTML页面,加上一个CSS,完全出于相同的原因,是由某人完成的,即只输入有关邮件的一些详细信息,等等),这将打开一个新邮件Outlook通过使用类似的窗口:

window.location = 'mailto:imcc_bucuresti@telekom.ro?cc=EVI-OPS-Techproject-TLs@evalueinternational.ro&subject=[ROG URGENTARE] ' + nrbonimcc + ' Jud.' + catreimccmare ;

Now, how can I make the batch script call a .js script to send a "mailto" command. 现在,如何使批处理脚本调用.js脚本来发送“ mailto”命令。

The batch script is something like this: 批处理脚本是这样的:

@echo off

title=MAIL TOOL

set mail1=mail1@address.com
set mail2=mail2@address.com
set mail3=mail3@address.com
set mail4=mail4@address.com
set mail5=mail5@address.com



:start
echo.
echo.
echo.
echo     MAIL TOOL
echo.
echo.
echo.
set /p zone=Enter a zone: 
if '%zone%'=='a' goto zone1
if '%zone%'=='b' goto zone1
if '%zone%'=='c' goto zone2
if '%zone%'=='d' goto zone2
etc



:zone1
echo.
echo.
echo.
echo     MAIL TOOL
echo.
echo.
echo.
echo     SENDING MAIL TO ZONE 1
echo.
echo.
echo.
outlook.exe /c ipm.note /m "%mail1%&cc=%workmail%&subject=ZONE 1 MAIL (%zone%)&body=ZONE 1 BODY TEXT"
echo.
echo     COMMAND EXECUTED SUCCESSFULLY, PRESS ANY KEY TO CONTINUE.
echo.
pause>NUL
goto start


:zone2
etc.

You're actually trying to open a mailto: URL, not run JS code. 您实际上是在尝试打开mailto: URL,而不是运行JS代码。

You can open an arbitrary URL from a batch file using start url . 您可以使用start url从批处理文件中打开任意URL。

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

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