Wombat Posted October 10, 2013 Share Posted October 10, 2013 Quick question, Can anyone explain why this does not work:Global $SmtpServer = IniRead(@ScriptDir & "\Ctrl.ini", "emailinfo", "SmtpServer", Default) ; address for the smtp-server to use - REQUIRED Global $FromName = "MIERT: " & "Computer = " & @ComputerName & "Logon Name = " & @UserName ; name from who the email was sent Global $FromAddress = IniRead(@ScriptDir & "\Ctrl.ini", "emailinfo", "FromAddress", Default) ; address from where the mail should come Global $ToAddress = IniRead(@ScriptDir & "\Ctrl.ini", "emailinfo", "ToAddress", Default) ; destination address of the email - REQUIRED Global $Subject = IniRead(@ScriptDir & "\Ctrl.ini", "emailinfo", "Subject", Default) ; subject from the email - can be anything you want it to be Global $Body ; the messagebody from the mail - can be left blank but then you get a blank mail Global $AttachFiles = @ScriptDir & IniRead(@ScriptDir & "\Ctrl.ini", "emailinfo", "AttachFiles", Default) ; the file(s) you want to attach seperated with a ; (Semicolon) - leave blank if not needed Global $CcAddress = IniRead(@ScriptDir & "\Ctrl.ini", "emailinfo", "CcAddress", Default) ; address for cc - leave blank if not needed Global $BccAddress = IniRead(@ScriptDir & "\Ctrl.ini", "emailinfo", "BccAddress", Default) ; address for bcc - leave blank if not needed Global $Importance = IniRead(@ScriptDir & "\Ctrl.ini", "emailinfo", "Importance", Default) ; Send message priority: "High", "Normal", "Low" Global $Username = IniRead(@ScriptDir & "\Ctrl.ini", "emailinfo", "Username", Default) ; username for the account used from where the mail gets sent - REQUIRED Global $Password = IniRead(@ScriptDir & "\Ctrl.ini", "emailinfo", "Password", Default) ; password for the account used from where the mail gets sent - REQUIRED Global $IPPort = IniRead(@ScriptDir & "\Ctrl.ini", "emailinfo", "IPPort", Default) ; port used for sending the mail Global $ssl = IniRead(@ScriptDir & "\Ctrl.ini", "emailinfo", "ssl", Default) ; enables/disables secure socket layer sending - put to 1 if using httpS If I hardcode the data into the script it works as in the OPs example:$SmtpServer = "MailServer" ; address for the smtp-server to use - REQUIRED $FromName = "Name" ; name from who the email was sent $FromAddress = "your@Email.Address.com" ; address from where the mail should come $ToAddress = "your@Email.Address.com" ; destination address of the email - REQUIRED $Subject = "Userinfo" ; subject from the email - can be anything you want it to be $Body = "" ; the messagebody from the mail - can be left blank but then you get a blank mail $AttachFiles = "" ; the file(s) you want to attach seperated with a ; (Semicolon) - leave blank if not needed $CcAddress = "CCadress1@test.com" ; address for cc - leave blank if not needed $BccAddress = "BCCadress1@test.com" ; address for bcc - leave blank if not needed $Importance = "Normal" ; Send message priority: "High", "Normal", "Low" $Username = "******" ; username for the account used from where the mail gets sent - REQUIRED $Password = "********" ; password for the account used from where the mail gets sent - REQUIRED $IPPort = 25 ; port used for sending the mail $ssl = 0 ; enables/disables secure socket layer sending - put to 1 if using httpS But if I try to read the data from an Ini file it is unable to connect to the server. Again, the EXACT same data in the ini file hardcoded into the script works, but read from an ini does not... any ideas? Just look at us.Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner The internet is our one and only hope at a truly free world, do not let them take it from us... Link to comment Share on other sites More sharing options...
Developers Solution Jos Posted October 10, 2013 Developers Solution Share Posted October 10, 2013 (edited) Try making the numeric fields really numeric: Global $IPPort = number(IniRead(@ScriptDir & "\Ctrl.ini", "emailinfo", "IPPort", Default)) ; port used for sending the mail Global $ssl = Number(IniRead(@ScriptDir & "\Ctrl.ini", "emailinfo", "ssl", Default)) ; enables/disables secure socket layer sending - put to 1 if using httpS Jos Edited October 10, 2013 by Jos Wombat 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Wombat Posted October 10, 2013 Author Share Posted October 10, 2013 (edited) I just figured this out and came to close this thread, thank you though for the speedy reply. While I have the thread open, is there anyway to read these from a ini? I need to have all of my variables stored in an ini for quick editing. Edited October 10, 2013 by Wombat Just look at us.Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner The internet is our one and only hope at a truly free world, do not let them take it from us... Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now