AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CDO COM - Email Delivery
Goto page Previous  1, 2, 3 ... 9, 10, 11, 12, 13  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
Sean



Joined: 12 Feb 2007
Posts: 2462

PostPosted: Tue Mar 02, 2010 5:08 pm    Post subject: Reply with quote

No, it's not that I want to prevent Tuncay or anyone else to redistribute COM.ahk. I was just reminded by tank that I once urged to have only one source of COM.ahk in the forum, due to the update issue. However, it's been long after the last update and I don't think there will be any other update either, so it may not be an issue anymore. (I suppose that COM will be built into AHK_L sooner or later.)

Anyway, just don't post the link to other location and/or don't copy the whole contents of COM.ahk in the posted code in the forum. Other than those, it's all up to your decision.
Back to top
View user's profile Send private message
jpjazzy



Joined: 16 Feb 2010
Posts: 799
Location: SciTE

PostPosted: Tue Mar 02, 2010 5:16 pm    Post subject: Reply with quote

Sean wrote:
No, it's not that I want to prevent Tuncay or anyone else to redistribute COM.ahk. I was just reminded by tank that I once urged to have only one source of COM.ahk in the forum, due to the update issue. However, it's been long after the last update and I don't think there will be any other update either, so it may not be an issue anymore.

Anyway, just don't post the link to other location or include the whole contents of COM.ahk in the posted code in the forum. Other than those, it's all up to your decision.


Thanks a lot Sean, I promise to abide by those rules. I do have a question though. Sorry I am inexperienced with COM but if I made an EXE of it then would the emailer in another script be able to run on a computer without AHK installed? If not how can I do that? Thanks again.
Back to top
View user's profile Send private message Visit poster's website
tank



Joined: 21 Dec 2007
Posts: 3700
Location: Louisville KY USA

PostPosted: Tue Mar 02, 2010 7:02 pm    Post subject: Reply with quote

COM would have to be part of the compiled script either by it being in the lib folder or via include for the cdo to function
_________________

We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
Back to top
View user's profile Send private message
Guest






PostPosted: Tue Mar 02, 2010 7:05 pm    Post subject: Reply with quote

tank wrote:
COM would have to be part of the compiled script either by it being in the lib folder or via include for the cdo to function


I see, thank you tank.
Back to top
Tuncay n-l-i mobile
Guest





PostPosted: Wed Mar 03, 2010 11:32 am    Post subject: Reply with quote

i would like to have this script in a function form. Am i allowed to wrap it as a function and republish it as a library? Or do you want make an official one at your first post?
Back to top
Sean



Joined: 12 Feb 2007
Posts: 2462

PostPosted: Wed Mar 03, 2010 2:04 pm    Post subject: Reply with quote

Yoy're Tuncay, right? If you put a proper credit, I don't have anything against it. And, no, I don't have a plan to update the code in the top post.

BTW, what will be the target(s) of the library? Only for the official build or also for AHK_L?
Back to top
View user's profile Send private message
Tuncay n-l-i mobile
Guest





PostPosted: Wed Mar 03, 2010 3:37 pm    Post subject: Reply with quote

Yes it's me Tuncay. I can't login now.

I am using the mainstream ahk. Others version than this are not tested by me. I leave that to the original author of every library.
Back to top
Tuncay



Joined: 07 Nov 2006
Posts: 1886
Location: Germany

PostPosted: Wed Mar 03, 2010 10:28 pm    Post subject: Reply with quote

Is this ok to use as a function? Would you suggest anything other than this? btw, the other parts of your code is leaved as is. I am just wrapping this script to a function.
Code:
cdomessage(sServer, nPort, bTLS, nSend, nAuth, sUsername, sPassword, sFrom, sTo, sSubject = "", sBody = "", sAttach = "")


Return code would be from
Code:
Send := COM_Invoke(pmsg, "Send")


I do not much understand the com and cdo etc.
_________________
{1:"ahkstdlib", 2:"my libs", 3:"my apps", 4:"my license"}
--> Don't feed the troll! <--
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Sean



Joined: 12 Feb 2007
Posts: 2462

PostPosted: Thu Mar 04, 2010 12:08 am    Post subject: Reply with quote

infogulch has already wrapped it into the function for AHK_L. The parmeter better be in that order, at least the fore part.
http://www.autohotkey.com/forum/topic39797-128.html

And, send has no return value.
Back to top
View user's profile Send private message
Tuncay



Joined: 07 Nov 2006
Posts: 1886
Location: Germany

PostPosted: Thu Mar 04, 2010 10:14 am    Post subject: Reply with quote

Is this better? What return could it have?
Code:

/*
; In this example, Email is sent using GMail SMTP (SSL) server.
cdomessage( sFrom     := "Mail_Address_Of_Sender"
          , sTo       := "Mail_Address_Of_Receipient"
          , sSubject  := "Message_Subject"
          , sBody     := "Message_Text"
          , sUsername := "your_username"
          , sPassword := "your_password"
          , sServer   := "smtp.gmail.com"   ; specify your SMTP server
          , nPort     := 465                ; 25
          , bTLS      := True               ; False
          , sAttach   := ""                 ; Path of attachment, "|" delimieted
          , nSend     := 2                  ; cdoSendUsingPort
          , nAuth     := 1 )                ; cdoBasic
*/

; CDO COM - Email Delivery by Sean
; http://www.autohotkey.com/forum/viewtopic.php?t=39797
cdomessage(sFrom, sTo, sSubject, sBody, sUsername, sPassword, sServer, nPort = 25, bTLS = False, sAttach = "", nSend = 2, nAuth = 1)

His version is unusable to me. I am not using Ahk_L currently.
_________________
{1:"ahkstdlib", 2:"my libs", 3:"my apps", 4:"my license"}
--> Don't feed the troll! <--
Back to top
View user's profile Send private message Send e-mail Visit poster's website
sinkfaze



Joined: 18 Mar 2008
Posts: 5044
Location: the tunnel(?=light)

PostPosted: Thu Mar 04, 2010 2:11 pm    Post subject: Reply with quote

I think what Sean means is that if you look at the parameters as related groups, all of the server specifications are mandatory while three of the mail-specific parameters (Subject, Body and Attach) are optional, so it's better just to move the entire group of mail-specific parameters to the end of the function:

Code:
cdo_message(sUsername, sPassword, sServer, nPort = 25, bTLS = False, nSend = 2, nAuth = 1,sFrom, sTo, sSubject="", sBody="", sAttach="")


Informally it might be slightly better to place the body parameter right before the subject parameter. Seems non-intuitive at first but many people send emails without subject lines, so it would save specifying a blank parameter in that case.

Tuncay wrote:
What return could it have?


I honestly don't think a return value would have any significance in this instance since the error messages the code already produces pretty much tell the story (although it would be nice to have a commented list of translations for the error messages in the function for reference, it might be a bit much).
_________________
Try Quick Search for Autohotkey or see the tutorial for newbies.


Last edited by sinkfaze on Thu Mar 04, 2010 4:29 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail
Sean



Joined: 12 Feb 2007
Posts: 2462

PostPosted: Thu Mar 04, 2010 3:24 pm    Post subject: Reply with quote

Actually what I'm using is this.
Code:
Email(sFrom, sTo, sSubject, sBody, sAttach, sServer, sUsername, sPassword, bTLS = True, nPort = 25, nSend = 2, nAuth = 1)

But, it has too many parameters and the ordering depends largely on user's typical usage of emails, so I left it to the users wrapping into a function.

BTW, cdosys.dll contains its own MessageTable, so you can also use FormatMessage API (with the flag FORMAT_MESSAGE_FROM_HMODULE), which COM_Error uses to format the system (:kernel32.dll) error messages.
Back to top
View user's profile Send private message
Gauss



Joined: 10 Sep 2009
Posts: 203

PostPosted: Thu Mar 18, 2010 12:44 pm    Post subject: Reply with quote

I could use clipboard as Body
Code:
sBody     := ""Clipboard ""


But how can I use my real user name and not the e-mail ID?

If I use this:

Code:
sUsername := "Dude"


I get error
But if I use my e-mail ID, for example.. If the e-mail I used was someone@gmail.com and I use
sUsername := "someone"
then it goes through but then the sender will be the e-mail address

Any ideas?
Back to top
View user's profile Send private message
sinkfaze



Joined: 18 Mar 2008
Posts: 5044
Location: the tunnel(?=light)

PostPosted: Thu Mar 18, 2010 1:52 pm    Post subject: Reply with quote

Could you post the entire code you're using? It's hard to figure out with just that one small piece of information.

By the way, in Sean's code sUsername is the username logon for the SMTP server, sFrom is for the from field in the email.
_________________
Try Quick Search for Autohotkey or see the tutorial for newbies.
Back to top
View user's profile Send private message Send e-mail
Sean



Joined: 12 Feb 2007
Posts: 2462

PostPosted: Thu Mar 18, 2010 3:33 pm    Post subject: Reply with quote

Yes, use sFrom as sinkfaze said. The usage is documented:
http://msdn.microsoft.com/en-us/library/ms527318%28EXCHG.10%29.aspx
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3 ... 9, 10, 11, 12, 13  Next
Page 10 of 13

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group