使用AutoIt发送电子邮件 [英] Send an email with AutoIt

查看:532
本文介绍了使用AutoIt发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用AutoIt发送电子邮件?只需一个干净的示例和说明,其中包含:

How to send an email with AutoIt? Just need a clean example and explanation, containing:

  • 来自
  • 主题
  • 消息

推荐答案

内置代码可使用两种主要方法:_INetMail()或_INetSmtpMail()

There are two main ways to go with built in code, _INetMail() or _INetSmtpMail()

下面是帮助文件中的简单代码示例.如果您对帮助文件没有涉及到它们的工作方式或实现方式有任何疑问,请发表评论.

Below are the simple code examples from the help file. If you have any specific questions about how they work or how to implement them not covered by the help file please leave a comment.

我认为_INetSmtpMail()路由更合理.下面是它的一些示例代码.

In my opinion the _INetSmtpMail() route is more reasonable. Below is some example code of it.

#include <INet.au3>

$s_SmtpServer = "mysmtpserver.com.au"
$s_FromName = "My Name"
$s_FromAddress = "From eMail Address"
$s_ToAddress = "To eMail Address"
$s_Subject = "My Test UDF"
Dim $as_Body[2]
$as_Body[0] = "Testing the new email udf"
$as_Body[1] = "Second Line"
$Response = _INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
$err = @error
If $Response = 1 Then
    MsgBox(0, "Success!", "Mail sent")
Else
    MsgBox(0, "Error!", "Mail failed with error code " & $err)
EndIf

使用在Windows中注册的内置邮件客户端的_INetMail()方法.

The _INetMail() method using the built in mail client registered with windows.

#include <INet.au3>

$Address = InputBox('Address', 'Enter the E-Mail address to send message to')
$Subject = InputBox('Subject', 'Enter a subject for the E-Mail')
$Body = InputBox('Body', 'Enter the body (message) of the E-Mail')
MsgBox(0,'E-Mail has been opened','The E-Mail has been opened and process identifier for the E-Mail client is ' & _INetMail($address, $subject, $body))

这篇关于使用AutoIt发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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