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 ... 10, 11, 12, 13  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
Gauss



Joined: 10 Sep 2009
Posts: 203

PostPosted: Thu Mar 18, 2010 6:11 pm    Post subject: Reply with quote

That's what I'm using, here is the whole part

Code:
sFrom     := "email@gmail.com" ;Sender E-Mail
sTo       := "email@yahoo.com" ;Receiver E-Mail
sBody     := ""Clipboard ""
sSubject  := "Hello"
;sAttach   :=
sServer   := "smtp.gmail.com"
nPort     := 465 ; 25
bTLS      := True ; False
nSend     := 2   ; cdoSendUsingPort
nAuth     := 1   ; cdoBasic
sUsername := "email" ; and here is the question, because the username shouldn't be "email" but my normal first and last name "G. Smith", but if I use that then it wont send, even though they are like that in my Gmail account :(
sPassword := "*********"


Any idea?
Back to top
View user's profile Send private message
Gauss



Joined: 10 Sep 2009
Posts: 203

PostPosted: Thu Mar 18, 2010 10:28 pm    Post subject: Reply with quote

Solution found

Here is how sFrom needs to look like
Code:
sFrom      = "Display name" <Youre-mail@gmail.com>

Thanks to emmanuel d http://www.autohotkey.com/forum/profile.php?mode=viewprofile&u=11809

Sean, maybe you should put that at the beginning of this thread for everyone.
And thanks a million (K)
Back to top
View user's profile Send private message
emmanuel d



Joined: 29 Jan 2009
Posts: 436
Location: Belgium

PostPosted: Fri Mar 19, 2010 4:58 pm    Post subject: Send Email Reply with quote

Added CC and BCC:
Code:
#include com.ahk

sFrom      = "Display name" <Youre-mail@gmail.com>
sTo       := "Mail_Address_Of_Receipient"
sBCC =   ; Blind Carbon Copy, Invisable for all, same syntax as CC
sCC = Some-mail@gmail.com, Some-Other-mail@gmail.com, Some-Other-mail@gmail.com ; Carbon Copy , visable to all

sSubject  := "Message_Subject"
sBody     := "Message_Text"
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 := "your_username"   ; What you use to login, eg everything before @gmail.com
sPassword := "your_password"    ; Pasword you use to login
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, "BCC", sBCC)
COM_Invoke(pmsg, "CC", sCC)
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()

_________________
Stopwatch
emdkplayer
http://www.autohotkey.com/forum/viewtopic.php?p=306819

the code i post falls under the:
WTFYW license
, wich meens its free to use
Back to top
View user's profile Send private message
TehEbil
Guest





PostPosted: Tue Mar 23, 2010 9:17 am    Post subject: Reply with quote

Wow, the Script is awesome ^^

Well done.

But now it's easy to see how many hackers they may be... Maybe every 2. Program has got an "trojan", or sth. like this^^

Btw. it didn't worf for me with the default port, I changed to 25, does it work now for other's?

And what this stands for??
Code:

nSend     := 2   ; cdoSendUsingPort
nAuth     := 1   ; cdoBasic
Back to top
TehEbil
Guest





PostPosted: Tue Mar 23, 2010 9:23 am    Post subject: Reply with quote

Sorry guys, I haven't got an Account here, yet.

I wanted to edit sth:

Why the Email I get is so big? Very Happy
It is about 850kb, the other's I got are about 40-50kb and they are much bigger.

And like sb has asked her before, I also dont understand followings:
Code:
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)


Thank you for your help =)
Back to top
tank



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

PostPosted: Tue Mar 23, 2010 12:58 pm    Post subject: Reply with quote

those are configuration settings you dont need to understand you just need to use them
_________________

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
Sean



Joined: 12 Feb 2007
Posts: 2462

PostPosted: Fri Mar 26, 2010 5:30 am    Post subject: Reply with quote

Quote:
And like sb has asked her before
Who is her? Are you a female?
Back to top
View user's profile Send private message
Guest






PostPosted: Wed Aug 18, 2010 2:09 pm    Post subject: Reply with quote

I get this com error every time i run the script!

Back to top
Guest






PostPosted: Wed Aug 18, 2010 2:16 pm    Post subject: Reply with quote

Sorry guys, i reinstalled AHK with the latest version & it worked
Thanks

Anonymous wrote:
I get this com error every time i run the script!

Back to top
Guest






PostPosted: Sat Nov 20, 2010 6:21 pm    Post subject: Reply with quote

Hello Sean,

This is not working on the builtin com in Ahk_L, can you rewrite this function?

Thanks
Back to top
shajul



Joined: 15 Sep 2006
Posts: 564

PostPosted: Mon Nov 29, 2010 7:19 pm    Post subject: solution.. Reply with quote

Anonymous wrote:
Hello Sean,

This is not working on the builtin com in Ahk_L, can you rewrite this function?

Thanks


Here goes..

Code:
sFrom     := "...@gmail.com"
sTo       := "anybody@somewhere.com"
sSubject  := "Message_Subject"
sBody     := "Message_Body"
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 := "...@gmail.com"
sPassword := "your_password_here"

pmsg :=   ComObjCreate("CDO.Message")
pcfg :=   pmsg.Configuration
pfld :=   pcfg.Fields

pfld.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") := nSend
pfld.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") := 60
pfld.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") := sServer
pfld.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") := nPort
pfld.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") := bTLS
pfld.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") := nAuth
pfld.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") := sUsername
pfld.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") := sPassword
pfld.Update()

pmsg.From := sFrom
pmsg.To := sTo
pmsg.Subject := sSubject
pmsg.TextBody := sBody
Loop, Parse, sAttach, |, %A_Space%%A_Tab%
  pmsg.AddAttachment := A_LoopField
pmsg.Send()
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
vla



Joined: 12 May 2007
Posts: 48

PostPosted: Mon Dec 20, 2010 10:43 am    Post subject: Reply with quote

Hi guys I love your code and I love you. A few questions, when Shajul's most recent version of the email code is used in one of my programs i get an error message:


However when i just a program with just the email script i get no such error and email arrives.


Second question: I have played around with it a bit and the only way i saw to send an email to two people is to double up on the code. Is this true?



EDIT: i think the first question was a problem with gui,submit not working fast enough. I have fixed this problem. Still need help on second question.
Back to top
View user's profile Send private message AIM Address
shajul



Joined: 15 Sep 2006
Posts: 564

PostPosted: Mon Dec 20, 2010 11:14 am    Post subject: Reply with quote

Quote:
Second question: I have played around with it a bit and the only way i saw to send an email to two people is to double up on the code. Is this true?


Code:
pmsg.To       := "anybody@somewhere.com, other-person@somewhere.com"
pmsg.BCC       := ""   ; Blind Carbon Copy, Invisable for all, same syntax as CC
pmsg.CC       := "Somebody@somewhere.com, Other-somebody@somewhere.com"
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
vla



Joined: 12 May 2007
Posts: 48

PostPosted: Mon Dec 20, 2010 11:35 am    Post subject: Reply with quote

Thank you, I think I see my problem, correct me if im wrong:

I am using vars for pmsg.To. So it would have to look like this?

Code:
pmsg.To       := var_email1"," var_email2



EDIT: forgot to put it in code.
Back to top
View user's profile Send private message AIM Address
shajul



Joined: 15 Sep 2006
Posts: 564

PostPosted: Mon Dec 20, 2010 11:54 am    Post subject: Reply with quote

no, it should be

Code:
pmsg.To := var_email1 . ", " . var_email2


notice the space after var_email1, also note that concatenation operator (.) better be used.
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3 ... 10, 11, 12, 13  Next
Page 11 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