Jump to content

Recommended Posts

Posted

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.

Posted

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!

Posted

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())
  • 3 weeks later...

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
×
×
  • Create New...