如何使用AutoIt发送电子邮件?只需要一个干净的例子和解释,其中包括:
最佳答案
内置代码有两种主要的处理方式,_INetMail()或_INetSmtpMail()
以下是帮助文件中的简单代码示例。如果您对帮助文件未涉及的工作方式或实现方式有任何疑问,请发表评论。
我认为_INetSmtpMail()路由更合理。下面是它的一些示例代码。
#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
_INetMail()方法使用在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))
关于email - 使用AutoIt发送电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3918747/