AutoHotkey Community

It is currently May 27th, 2012, 2:24 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 199 posts ]  Go to page Previous  1 ... 6, 7, 8, 9, 10, 11, 12 ... 14  Next
Author Message
 Post subject:
PostPosted: December 12th, 2009, 3:17 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
To those members who want to use Explicit SSL with this script, I suggest to try to specify the usual port number 25, not explicitly 587.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 3rd, 2010, 5:18 am 
Offline

Joined: December 17th, 2008, 5:36 am
Posts: 80
I am recieving the following error on every computer in my house.

Image


Every computer in my house has Windows 7 32 or 64 and is connected to a domain. I use static IP address and obviously my Domain server is also the DNS server.

Any idea what this error might mean and why it doesn't work?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 3rd, 2010, 8:19 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
What SMTP server did you use? Better post the whole code you used.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 3rd, 2010, 10:32 pm 
Sean wrote:
What SMTP server did you use? Better post the whole code you used.



Code:
/*
protect your hardware

The script starts with the PC, try to get the external IP and send an email with the pc-name and IP-number.
It does this only if the IP changes. For the autostart it writes to registry.

You've to add your email data and then you should compile the script with nodecompile.

To use it, put the compiled Exe somewhere and start it once. Then you get periodically emails with
the external IP.

author: haichen 2009

used code:
--------------
cdo com - email delivery
author sean
http://www.autohotkey.com/forum/viewtopic.php?t=39797

com - standard library
code from sean
http://www.autohotkey.com/forum/viewtopic.php?p=146242#146242

URLDownloadToVar
from Olfen
http://www.autohotkey.com/forum/viewtopic.php?p=64230#64230

Retrieve "external IP Adress"
from SKAN
http://www.autohotkey.com/forum/viewtopic.php?p=42420#42420

IP-number pattern
http://regexlib.com

Get your extern IP
http://Checkip.dyndns.org/

This script:
http://www.autohotkey.com/forum/viewtopic.php?p=316526#316526

*/
#NoTrayIcon
#include COM.ahk
;~ ; filename where to store the IP-number
;~ tmp=m189hhj.tmp
;~ TmpFile=%WinDir%\TEMP\%tmp%

;~ ; get your external IP
;~ MyExternalIPText := UrlDownloadToVar("http://Checkip.dyndns.org/")
;~ pattern=\b(([01]?\d?\d|2[0-4]\d|25[0-5])\.){3}([01]?\d?\d|2[0-4]\d|25[0-5])\b
;~ FoundPos := RegExMatch(MyExternalIPText, pattern, IP)
;~ ;-----------------------------------------------------------------
;~ ; if you install the program as a service you should comment this block
;~ ;Autostart
;~ regname=mip
;~ If a_isCompiled
;~   RegWrite,REG_SZ,HKEY_CURRENT_USER,Software\Microsoft\Windows\CurrentVersion\Run,%regname%,"%A_ScriptDir%\%A_ScriptName%"
;~ ;-----------------------------------------------------------------
;~ ; change your email params here
sFrom     := "blah@gmail.com"
sTo       := "blah@gmail.com"
sSubject  := "asdfasdfasdfasdfsde"
sBody     = Blah yadda yadda blah
sAttach   := ;"Path_Of_Attachment" ; can add Multiple attachments, the Delimiter is |

sServer   := "smtp.gmail.com" ; specify your SMTP server
nPort     := 465 ; 25
bTLS      := True ; False
nSend     := 2   ; cdoSendUsingPort
nAuth     := 1   ; cdoBasic
sUsername := "blah@gmail.com"
sPassword := "xxxxx"
;-----------------------------------------------------------------

;~ FileReadLine,oldIP,%TmpFile%,1

;~ If ((ip<>"") and (oldIP <> ip) )
;~ {
;~   FileDelete,%TmpFile%
;~   FileAppend, %IP%`n ,%TmpFile%

  COM_Init()
  pmsg :=   COM_CreateObject("CDO.Message")
  pcfg :=   COM_Invoke(pmsg, "Configuration")
  pfld :=   COM_Invoke(pcfg, "Fields")

  COM_Invoke(pfld, "Item", "http://schemas.microsoft.com/cdo/configuration/Sendusing", nSend)
  COM_Invoke(pfld, "Item", "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout", 60)
  COM_Invoke(pfld, "Item", "http://schemas.microsoft.com/cdo/configuration/smtpserver", sServer)
  COM_Invoke(pfld, "Item", "http://schemas.microsoft.com/cdo/configuration/smtpserverport", nPort)
  COM_Invoke(pfld, "Item", "http://schemas.microsoft.com/cdo/configuration/smtpusessl", bTLS)
  COM_Invoke(pfld, "Item", "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", nAuth)
  COM_Invoke(pfld, "Item", "http://schemas.microsoft.com/cdo/configuration/Sendusername", sUsername)
  COM_Invoke(pfld, "Item", "http://schemas.microsoft.com/cdo/configuration/SendPassword", sPassword)
  COM_Invoke(pfld, "Update")

  COM_Invoke(pmsg, "From", sFrom)
  COM_Invoke(pmsg, "To", sTo)
  COM_Invoke(pmsg, "Subject", sSubject)
  COM_Invoke(pmsg, "TextBody", sBody)
  Loop, Parse, sAttach, |, %A_Space%%A_Tab%
    COM_Invoke(pmsg, "AddAttachment", A_LoopField)
  COM_Invoke(pmsg, "Send")

  COM_Release(pfld)
  COM_Release(pcfg)
  COM_Release(pmsg)
  COM_Term()
;~ }
Return

;functions

UrlDownloadToVar(URL, Proxy="", ProxyBypass="") {
    AutoTrim, Off
    hModule := DllCall("LoadLibrary", "str", "wininet.dll")

    If (Proxy != "")
      AccessType=3
    Else
      AccessType=1
    ;INTERNET_OPEN_TYPE_PRECONFIG                    0   // use registry configuration
    ;INTERNET_OPEN_TYPE_DIRECT                       1   // direct to net
    ;INTERNET_OPEN_TYPE_PROXY                        3   // via named proxy
    ;INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY  4   // prevent using java/script/INS

    io_hInternet := DllCall("wininet\InternetOpenA"
            , "str", "" ;lpszAgent
            , "uint", AccessType
            , "str", Proxy
            , "str", ProxyBypass
            , "uint", 0) ;dwFlags

    iou := DllCall("wininet\InternetOpenUrlA"
            , "uint", io_hInternet
            , "str", url
            , "str", "" ;lpszHeaders
            , "uint", 0 ;dwHeadersLength
            , "uint", 0x80000000 ;dwFlags: INTERNET_FLAG_RELOAD = 0x80000000 // retrieve the original item
            , "uint", 0) ;dwContext

    If (ErrorLevel != 0 or iou = 0) {
      DllCall("FreeLibrary", "uint", hModule)
      Return 0
    }

    VarSetCapacity(buffer, 512, 0)
    VarSetCapacity(NumberOfBytesRead, 4, 0)
    Loop
    {
      irf := DllCall("wininet\InternetReadFile", "uint", iou, "uint", &buffer, "uint", 512, "uint", &NumberOfBytesRead)
      NOBR = 0
      Loop 4  ; Build the Integer by adding up its bytes. - ExtractInteger
        NOBR += *(&NumberOfBytesRead + A_Index-1) << 8*(A_Index-1)
      IfEqual, NOBR, 0, Break
      ;BytesReadTotal += NOBR
      DllCall("lstrcpy", "str", buffer, "uint", &buffer)
      res = %res%%buffer%
    }
    StringTrimRight, res, res, 2

    DllCall("wininet\InternetCloseHandle",  "uint", iou)
    DllCall("wininet\InternetCloseHandle",  "uint", io_hInternet)
    DllCall("FreeLibrary", "uint", hModule)
    AutoTrim, on
    Return, res
  }


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 3rd, 2010, 10:39 pm 
Offline

Joined: December 17th, 2008, 5:36 am
Posts: 80
Sean wrote:
What SMTP server did you use? Better post the whole code you used.


sorry, yeah that might help--lol.

I changed nothing except used my gmail address and password.


Code:
/*
protect your hardware

The script starts with the PC, try to get the external IP and send an email with the pc-name and IP-number.
It does this only if the IP changes. For the autostart it writes to registry.

You've to add your email data and then you should compile the script with nodecompile.

To use it, put the compiled Exe somewhere and start it once. Then you get periodically emails with
the external IP.

author: haichen 2009

used code:
--------------
cdo com - email delivery
author sean
http://www.autohotkey.com/forum/viewtopic.php?t=39797

com - standard library
code from sean
http://www.autohotkey.com/forum/viewtopic.php?p=146242#146242

URLDownloadToVar
from Olfen
http://www.autohotkey.com/forum/viewtopic.php?p=64230#64230

Retrieve "external IP Adress"
from SKAN
http://www.autohotkey.com/forum/viewtopic.php?p=42420#42420

IP-number pattern
http://regexlib.com

Get your extern IP
http://Checkip.dyndns.org/

This script:
http://www.autohotkey.com/forum/viewtopic.php?p=316526#316526

*/
#NoTrayIcon
#include COM.ahk
;~ ; filename where to store the IP-number
;~ tmp=m189hhj.tmp
;~ TmpFile=%WinDir%\TEMP\%tmp%

;~ ; get your external IP
;~ MyExternalIPText := UrlDownloadToVar("http://Checkip.dyndns.org/")
;~ pattern=\b(([01]?\d?\d|2[0-4]\d|25[0-5])\.){3}([01]?\d?\d|2[0-4]\d|25[0-5])\b
;~ FoundPos := RegExMatch(MyExternalIPText, pattern, IP)
;~ ;-----------------------------------------------------------------
;~ ; if you install the program as a service you should comment this block
;~ ;Autostart
;~ regname=mip
;~ If a_isCompiled
;~   RegWrite,REG_SZ,HKEY_CURRENT_USER,Software\Microsoft\Windows\CurrentVersion\Run,%regname%,"%A_ScriptDir%\%A_ScriptName%"
;~ ;-----------------------------------------------------------------
;~ ; change your email params here
sFrom     := "blah@gmail.com"
sTo       := "blah@gmail.com"
sSubject  := "asdfasdfasdfasdfsde"
sBody     = Blah yadda yadda blah
sAttach   := ;"Path_Of_Attachment" ; can add Multiple attachments, the Delimiter is |

sServer   := "smtp.gmail.com" ; specify your SMTP server
nPort     := 465 ; 25
bTLS      := True ; False
nSend     := 2   ; cdoSendUsingPort
nAuth     := 1   ; cdoBasic
sUsername := "blah@gmail.com"
sPassword := "xxxxx"
;-----------------------------------------------------------------

;~ FileReadLine,oldIP,%TmpFile%,1

;~ If ((ip<>"") and (oldIP <> ip) )
;~ {
;~   FileDelete,%TmpFile%
;~   FileAppend, %IP%`n ,%TmpFile%

  COM_Init()
  pmsg :=   COM_CreateObject("CDO.Message")
  pcfg :=   COM_Invoke(pmsg, "Configuration")
  pfld :=   COM_Invoke(pcfg, "Fields")

  COM_Invoke(pfld, "Item", "http://schemas.microsoft.com/cdo/configuration/Sendusing", nSend)
  COM_Invoke(pfld, "Item", "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout", 60)
  COM_Invoke(pfld, "Item", "http://schemas.microsoft.com/cdo/configuration/smtpserver", sServer)
  COM_Invoke(pfld, "Item", "http://schemas.microsoft.com/cdo/configuration/smtpserverport", nPort)
  COM_Invoke(pfld, "Item", "http://schemas.microsoft.com/cdo/configuration/smtpusessl", bTLS)
  COM_Invoke(pfld, "Item", "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", nAuth)
  COM_Invoke(pfld, "Item", "http://schemas.microsoft.com/cdo/configuration/Sendusername", sUsername)
  COM_Invoke(pfld, "Item", "http://schemas.microsoft.com/cdo/configuration/SendPassword", sPassword)
  COM_Invoke(pfld, "Update")

  COM_Invoke(pmsg, "From", sFrom)
  COM_Invoke(pmsg, "To", sTo)
  COM_Invoke(pmsg, "Subject", sSubject)
  COM_Invoke(pmsg, "TextBody", sBody)
  Loop, Parse, sAttach, |, %A_Space%%A_Tab%
    COM_Invoke(pmsg, "AddAttachment", A_LoopField)
  COM_Invoke(pmsg, "Send")

  COM_Release(pfld)
  COM_Release(pcfg)
  COM_Release(pmsg)
  COM_Term()
;~ }
Return

;functions

UrlDownloadToVar(URL, Proxy="", ProxyBypass="") {
    AutoTrim, Off
    hModule := DllCall("LoadLibrary", "str", "wininet.dll")

    If (Proxy != "")
      AccessType=3
    Else
      AccessType=1
    ;INTERNET_OPEN_TYPE_PRECONFIG                    0   // use registry configuration
    ;INTERNET_OPEN_TYPE_DIRECT                       1   // direct to net
    ;INTERNET_OPEN_TYPE_PROXY                        3   // via named proxy
    ;INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY  4   // prevent using java/script/INS

    io_hInternet := DllCall("wininet\InternetOpenA"
            , "str", "" ;lpszAgent
            , "uint", AccessType
            , "str", Proxy
            , "str", ProxyBypass
            , "uint", 0) ;dwFlags

    iou := DllCall("wininet\InternetOpenUrlA"
            , "uint", io_hInternet
            , "str", url
            , "str", "" ;lpszHeaders
            , "uint", 0 ;dwHeadersLength
            , "uint", 0x80000000 ;dwFlags: INTERNET_FLAG_RELOAD = 0x80000000 // retrieve the original item
            , "uint", 0) ;dwContext

    If (ErrorLevel != 0 or iou = 0) {
      DllCall("FreeLibrary", "uint", hModule)
      Return 0
    }

    VarSetCapacity(buffer, 512, 0)
    VarSetCapacity(NumberOfBytesRead, 4, 0)
    Loop
    {
      irf := DllCall("wininet\InternetReadFile", "uint", iou, "uint", &buffer, "uint", 512, "uint", &NumberOfBytesRead)
      NOBR = 0
      Loop 4  ; Build the Integer by adding up its bytes. - ExtractInteger
        NOBR += *(&NumberOfBytesRead + A_Index-1) << 8*(A_Index-1)
      IfEqual, NOBR, 0, Break
      ;BytesReadTotal += NOBR
      DllCall("lstrcpy", "str", buffer, "uint", &buffer)
      res = %res%%buffer%
    }
    StringTrimRight, res, res, 2

    DllCall("wininet\InternetCloseHandle",  "uint", iou)
    DllCall("wininet\InternetCloseHandle",  "uint", io_hInternet)
    DllCall("FreeLibrary", "uint", hModule)
    AutoTrim, on
    Return, res
  }


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 4th, 2010, 3:43 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
The error was CDO_E_LOGON_FAILURE, i.e. log-on to the server was failed. I can see one error in your code, although a small one, so, be sure that the code has no syntax error, correct password, etc.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 4th, 2010, 5:05 am 
Sean wrote:
The error was CDO_E_LOGON_FAILURE, i.e. log-on to the server was failed. I can see one error in your code, although a small one, so, be sure that the code has no syntax error, correct password, etc.


I went through everything like you suggested and its now working fine. Thanks for you time. Wish I would have check it more thoroughly before posting.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 4th, 2010, 1:02 pm 
For better convinience I've extracted the errorcodes from MSDN.
Quote:
    CDO_E_UNCAUGHT_EXCEPTION
    0x80040201L
    Exception %1 was generated at address %2

    CDO_E_NOT_OPENED
    0x80040202L
    No data source has been opened for the object.

    CDO_E_UNSUPPORTED_DATASOURCE
    0x80040203L
    The object does not support this type of data source.

    CDO_E_INVALID_PROPERTYNAME
    0x80040204L
    The object does not support the requested property name or namespace.

    CDO_E_PROP_UNSUPPORTED
    0x80040205L
    The object does not support the requested property.

    CDO_E_INACTIVE
    0x80040206L
    The object is not active. It may have been deleted or it may not have been opened.

    CDO_E_NO_SUPPORT_FOR_OBJECTS
    0x80040207L
    The object does not support storing persistent state information for objects.

    CDO_E_NOT_AVAILABLE
    0x80040208L
    The requested property or feature, while supported, is not available at this time or in this context.

    CDO_E_NO_DEFAULT_DROP_DIR
    0x80040209L
    No default drop directory has been configured for this server.

    CDO_E_SMTP_SERVER_REQUIRED
    0x8004020AL
    The SMTP server name is required, and was not found in the configuration source.

    CDO_E_NNTP_SERVER_REQUIRED
    0x8004020BL
    The NNTP server name is required, and was not found in the configuration source.

    CDO_E_RECIPIENT_MISSING
    0x8004020CL
    At least one recipient is required, but none were found.

    CDO_E_FROM_MISSING
    0x8004020DL
    At least one of the From or Sender fields is required, and neither was found.

    CDO_E_SENDER_REJECTED
    0x8004020EL
    The server rejected the sender address. The server response was: %1

    CDO_E_RECIPIENTS_REJECTED
    0x8004020FL
    The server rejected one or more recipient addresses. The server response was: %1

    CDO_E_NNTP_POST_FAILED
    0x80040210L
    The message could not be posted to the NNTP server. The transport error code was %2. The server response was %1

    CDO_E_SMTP_SEND_FAILED
    0x80040211L
    The message could not be sent to the SMTP server. The transport error code was %2. The server response was %1

    CDO_E_CONNECTION_DROPPED
    0x80040212L
    The transport lost its connection to the server.

    CDO_E_FAILED_TO_CONNECT
    0x80040213L
    The transport failed to connect to the server.

    CDO_E_INVALID_POST
    0x80040214L
    The Subject, From, and Newsgroup fields are all required, and one or more was not found.

    CDO_E_AUTHENTICATION_FAILURE
    0x80040215L
    The server rejected the logon attempt due to authentication failure. The server response was: %1

    CDO_E_INVALID_CONTENT_TYPE
    0x80040216L
    The content type was not valid in this context. For exmaple, the root of an MHTML message must be an HTML document.

    CDO_E_LOGON_FAILURE
    0x80040217L
    The transport was unable to log on to the server.

    CDO_E_HTTP_NOT_FOUND
    0x80040218L
    The requested resource could not be found. The server response was: %1.

    CDO_E_HTTP_FORBIDDEN
    0x80040219L
    Access to the requested resource is denied. The server response was: %1.

    CDO_E_HTTP_FAILED
    0x8004021AL
    The HTTP request failed. The server response was: %1.

    CDO_E_MULTIPART_NO_DATA
    0x8004021BL
    This is a multipart body part. It has no content other than the body parts contained within it.

    CDO_E_INVALID_ENCODING_FOR_MULTIPART
    0x8004021CL
    Multipart body parts must be encoded as 7bit, 8bit, or binary.

    CDO_E_PROP_NOT_FOUND
    0x8004021EL
    The requested property was not found.

    CDO_E_INVALID_SEND_OPTION
    0x80040220L
    The "SendUsing" configuration value is invalid.

    CDO_E_INVALID_POST_OPTION
    0x80040221L
    The "PostUsing" configuration value is invalid.

    CDO_E_NO_PICKUP_DIR
    0x80040222L
    The pickup directory path is required and was not specified.

    CDO_E_NOT_ALL_DELETED
    0x80040223L
    One or more messages could not be deleted.

    CDO_E_PROP_READONLY
    0x80040227L
    The property is read-only.

    CDO_E_PROP_CANNOT_DELETE
    0x80040228L
    The property cannot be deleted.

    CDO_E_BAD_DATA
    0x80040229L
    Data written to the object are inconsistent or invalid.

    CDO_E_PROP_NONHEADER
    0x8004022AL
    The requested property is not in the mail header namespace.

    CDO_E_INVALID_CHARSET
    0x8004022BL
    The requested character set is not installed on the computer.

    CDO_E_ADOSTREAM_NOT_BOUND
    0x8004022CL
    The ADO stream has not been opened.

    CDO_E_CONTENTPROPXML_NOT_FOUND
    0x8004022DL
    The content properties are missing.

    CDO_E_CONTENTPROPXML_WRONG_CHARSET
    0x8004022EL
    Content properties XML must be encoded using UTF-8.

    CDO_E_CONTENTPROPXML_PARSE_FAILED
    0x8004022FL
    Failed to parse content properties XML.

    CDO_E_CONTENTPROPXML_CONVERT_FAILED
    0x80040230L
    Failed to convert a property from XML to a requested type.

    CDO_E_NO_DIRECTORIES_SPECIFIED
    0x80040231L
    No directories were specified for resolution.

    CDO_E_DIRECTORIES_UNREACHABLE
    0x80040232L
    Failed to resolve against one or more of the specified directories.

    CDO_E_BAD_SENDER
    0x80040233L
    Could not find the Sender's mailbox.

    CDO_E_SELF_BINDING
    0x80040234L
    Binding to self is not allowed.

    CDO_E_ARGUMENT1
    0x80044000L
    The first argument is invalid.

    CDO_E_ARGUMENT2
    0x80044001L
    The second argument is invalid.

    CDO_E_ARGUMENT3
    0x80044002L
    The third argument is invalid.

    CDO_E_ARGUMENT4
    0x80044003L
    The fourth argument is invalid.

    CDO_E_ARGUMENT5
    0x80044004L
    The fifth argument is invalid.

    CDO_E_NOT_FOUND
    0x800CCE05L
    The requested body part was not found in this message.

    CDO_E_INVALID_ENCODING_TYPE
    0x800CCE1DL
    The content encoding type is invalid.


PS: haven't made it to detect to compare the error msg responded via CDO. :?
PPS: Beside the above mentioned issue I wasn't able to find out how to set the read receipt option (see here)within SEANs script. If anyone can help me on this I'd really appreciate it. Thx for your time :(


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 4th, 2010, 11:56 pm 
Offline

Joined: March 27th, 2008, 2:14 pm
Posts: 700
I tried porting this script to autohotkey_l and wrapping it in a function, but it's not working.
If I just adjust the values in the script in the first post and run that, it works fine. I think I'm messing up my translation.

Error:
Code:
COM Error Notification
Function Name:   "Send"
ERROR:      (0x80040211)
DESC:   The message could not be sent to the SMTP server. The transport error code was 0x80040217. The server response was not available
HELP:   ,0


This is my code:
Code:
Email("from@email.com", "receipient@emails.com", "Message_Subject", "Message_Text", "username", "password", "sbserver.domain.local")

Email(pFrom, pTo, pSubject, pBody, pUsername, pPassword, pServer, pPort=25, pUseSSL=False, pAttach="", isHtml=False) {
   pmsg := COM_CreateObject("CDO.Message")
   
   base := "http://schemas.microsoft.com/cdo/configuration/"
   pfld := pmsg.Configuration.Fields
   pfld.Item(base "sendusing").value             := 2 ; 2=cdoSendUsingPort (requires: smtpserverport, smtpauthenticate, smtpserver)
   pfld.Item(base "smtpconnectiontimeout").value := 60
   pfld.Item(base "smtpusessl").value            := pUseSSL
   pfld.Item(base "smtpauthenticate").value      := 1 ; 1=cdoBasic
   pfld.Item(base "smtpserver").value            := pServer
   pfld.Item(base "smtpserverport").value        := pPort
   pfld.Item(base "sendusername").value          := pUsername
   pfld.Item(base "sendpassword").value          := pPassword
   pfld.Update()

   pmsg.From     := pFrom
   pmsg.To       := pTo
   pmsg.Subject  := pSubject

   if isHtml
      pmsg.HtmlBody := pBody
   else
      pmsg.TextBody := pBody
   
   Loop, Parse, pAttach, |, %A_Space%%A_Tab%
      pmsg.AddAttachment(A_LoopField)
   
   pmsg.Send()

   pfld := ""
   pmsg := ""
}
(Note: it fails the same with or without the .value property reference)

_________________
Scripts - License


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 6th, 2010, 2:06 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
The code looks fine. So, the error may be in other places.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 8th, 2010, 10:26 pm 
Offline

Joined: March 27th, 2008, 2:14 pm
Posts: 700
Yeah it's working now... nfi why. :?

Thanks :D

_________________
Scripts - License


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 2nd, 2010, 5:03 am 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5480
Location: the tunnel(?=light)
Shucks, and I was hoping to be the first kid on my block to re-write CDO COM for AHK_L :oops: ...oh well, here's my re-write, a little more abstract, and big thanks to infogulch for demonstrating through his code how to fix a problem I was incurring in mine!

Code:
sFrom := "Mail_Address_Of_Sender"
sTo := "Mail_Address_Of_Receipient"
sSubject := "Message_Subject"
sBody := "Message_Text"
sAttach := "Path_Of_Attachment"
mAttrib = From|To|Subject|TextBody
vars2 = sFrom|sTo|sSubject|sBody
StringSplit, Attrib, mAttrib, |

sServer := "smtp.gmail.com" ; specify your SMTP server
nPort := 465 ; 25
bTLS := True ; False
nSend := 2   ; cdoSendUsingPort
nAuth := 1   ; cdoBasic
tOut := 60
url := "http://schemas.microsoft.com/cdo/configuration/"
uSub = sendusing|smtpconnectiontimeout|smtpserver|smtpserverport|smtpusessl|smtpauthenticate|sendusername|sendpassword
vars1 = nSend|tOut|sServer|nPort|bTLS|nAuth|sUsername|sPassword
StringSplit, sub, uSub, |

sUsername := "your_username"
sPassword := "your_password"

pmsg :=   COM_CreateObject("CDO.Message")
pfld :=   pmsg.Configuration.Fields
Loop, Parse, vars1, |
   pfld.Item[url sub%A_Index%]:= %A_LoopField%
pfld.Update()
Loop, Parse, vars2, |
   pmsg[Attrib%A_Index%]:= %A_LoopField%
if sAttach
   Loop, Parse, sAttach, |, %A_Space%%A_Tab%
      pmsg.AddAttachment[A_LoopField]
pmsg.Send()
pfld:=pmsg:=""
return

_________________
Image
Try Quick Search for Autohotkey or see the tutorial for newbies.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 2nd, 2010, 5:09 pm 
Offline

Joined: February 16th, 2010, 8:01 am
Posts: 800
Location: SciTE
Sean,

First of all I would just like to say great job on this emailer, it is exactly what I have been looking for. I am using it with one of my programs and since it requires COM I was wondering if I could please get permission from you to upload the COM.ahk file to my Directory of files so that I may make it optional for my program to work or not by making it run by having it download from a URL. If I take it down then it would make it so users could no longer get their key to use my AHK file... Thank you.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 2nd, 2010, 5:34 pm 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
Why aren't you linking to the original source? That's the preferred way, although I'm feeling that I contradict myself on it. See this post.
http://www.autohotkey.com/forum/viewtopic.php?t=54996


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 2nd, 2010, 5:44 pm 
Sean wrote:
Why aren't you linking to the original source? That's the preferred way, although I'm feeling that I contradict myself on it. See this post.
http://www.autohotkey.com/forum/viewtopic.php?t=54996


The open source is available to everyone and I don't have control if it is taken down. The reason I wanted to do this is because after giving out like 10 copies of my AHK program I want to cut people off from getting keys and removing the COM would make it so their keys could not be emailed to me so therefore I just wanted control over deleting whether they actually could get the key emailed to me because I am not going to allow people to email me for the key for very long... maybe like a month... and I saw that post the other day. If you just talked to Tuncay I bet he would be willing to comply with your demands too, and if not you could just ask him why he got a License for something other people made. :lol:

-jpjazzy


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 199 posts ]  Go to page Previous  1 ... 6, 7, 8, 9, 10, 11, 12 ... 14  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: MSN [Bot] and 12 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group