Sign in to follow this  
Followers 0
NSearch

Using _INetMail with attachments

4 posts in this topic

I am trying to write a script with attaches a file to an email and automatically sends it out. Is there any way to use _INetMail and attach files? Or is there a different function that I could use?

Thanks.

Share this post


Link to post
Share on other sites



Maybe you can try something like this....

$objMessage = ObjCreate("CDO.Message")
$objMessage.From = "nobody@nobody.com"
$objMessage.To = "nobody@nobody.com"
$objMessage.Subject = "Test"
$objMessage.TextBody = "Test"
$objMessage.AddAttachment(@ScriptDir & "\Test.txt")
$objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
$objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "your providers smtp"
$objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
$objMessage.Configuration.Fields.Update
$objMessage.Send

Sapiente vince, rex, noli vincere ferro!

Share this post


Link to post
Share on other sites

Just a note, the AddAttachment method requires that the parameter be the exact path to a file (not relative).

@WorkingDir & '\file.txt' may be a more appropriate approach depending upon your situation


Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

Share this post


Link to post
Share on other sites

I'm new to AutoIt, so can you explain which #include I need to use to get the ObjCreate("CDO.Message") to work?

Thanks

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  
Followers 0