Jump to content
Sign in to follow this  
sovietunion

why cant i send gmail with attachFiles?

Recommended Posts

sovietunion

it's ok to send gmail without attachfiles.it returns "error code 2" when i set $s_AttachFiles,eg:$s_AttachFiles = "D:\glut3.7.zip".why? thx for reading!

the udf SmtpMailer.au3 is attached。

#include <SmtpMailer.au3>

$s_SmtpServer = "smtp.gmail.com" ; smtp服务器 address for the smtp-server to use - REQUIRED

$s_FromName = "myname" ; 邮件发送人 name from who the email was sent

$s_FromAddress = "myusrnme@gmail.com" ; 邮件发送者地址address from where the mail should come

$s_ToAddress = "myusrnme@gmail.com" ; 邮件发送给谁 destination address of the email - REQUIRED

$s_Subject = "autoittest" ;邮件标题 subject from the email - can be anything you want it to be

$as_Body = "autoittest" & @CRLF & _

"http://bbs.yidabu.com/forum-2-1.html" ; 邮件正文the messagebody from the mail - can be left blank but then you get a blank mail

$s_AttachFiles = "" ; 附件地址 the file you want to attach- leave blank if not needed

$s_CcAddress = "" ; address for cc - leave blank if not needed

$s_BccAddress = "" ; address for bcc - leave blank if not needed

$s_Username = "myusrnme" ; 用户名 username for the account used from where the mail gets sent - REQUIRED

$s_Password = "mypass" ; 密码password for the account used from where the mail gets sent - REQUIRED

$IPPort=465 ; yidabu.com提示:Gmail使用的发送端口

$ssl=1 ; yidabu.com提示:Gmail要启用安全连接

Global $oMyRet[2]

Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")

$rc = _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, $s_AttachFiles, $s_CcAddress, $s_BccAddress, $s_Username, $s_Password, $IPPort, $ssl)

If @error Then

MsgBox(0, "Error sending message", "Error code:" & @error & " Description:" & $rc)

EndIf

SmtpMailer.au3

Share this post


Link to post
Share on other sites
sovietunion

it's ok to send gmail without attachfiles.it returns "error code 2" when i set $s_AttachFiles,eg:$s_AttachFiles = "D:\glut3.7.zip".why? thx for reading!

the udf SmtpMailer.au3 is attached。

#include <SmtpMailer.au3>

$s_SmtpServer = "smtp.gmail.com" ; smtp服务器 address for the smtp-server to use - REQUIRED

$s_FromName = "myname" ; 邮件发送人 name from who the email was sent

$s_FromAddress = "myusrnme@gmail.com" ; 邮件发送者地址address from where the mail should come

$s_ToAddress = "myusrnme@gmail.com" ; 邮件发送给谁 destination address of the email - REQUIRED

$s_Subject = "autoittest" ;邮件标题 subject from the email - can be anything you want it to be

$as_Body = "autoittest" & @CRLF & _

"http://bbs.yidabu.com/forum-2-1.html" ; 邮件正文the messagebody from the mail - can be left blank but then you get a blank mail

$s_AttachFiles = "" ; 附件地址 the file you want to attach- leave blank if not needed

$s_CcAddress = "" ; address for cc - leave blank if not needed

$s_BccAddress = "" ; address for bcc - leave blank if not needed

$s_Username = "myusrnme" ; 用户名 username for the account used from where the mail gets sent - REQUIRED

$s_Password = "mypass" ; 密码password for the account used from where the mail gets sent - REQUIRED

$IPPort=465 ; yidabu.com提示:Gmail使用的发送端口

$ssl=1 ; yidabu.com提示:Gmail要启用安全连接

Global $oMyRet[2]

Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")

$rc = _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, $s_AttachFiles, $s_CcAddress, $s_BccAddress, $s_Username, $s_Password, $IPPort, $ssl)

If @error Then

MsgBox(0, "Error sending message", "Error code:" & @error & " Description:" & $rc)

EndIf

this is the error.

post-35042-1211352788_thumb.jpg

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×