AutoHotkey Community

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

All times are UTC [ DST ]




Post new topic Reply to topic  [ 199 posts ]  Go to page Previous  1 ... 8, 9, 10, 11, 12, 13, 14  Next
Author Message
 Post subject:
PostPosted: March 18th, 2010, 7:11 pm 
Offline

Joined: September 10th, 2009, 5:54 pm
Posts: 203
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?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 18th, 2010, 11:28 pm 
Offline

Joined: September 10th, 2009, 5:54 pm
Posts: 203
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)


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Send Email
PostPosted: March 19th, 2010, 5:58 pm 
Offline

Joined: January 29th, 2009, 9:50 pm
Posts: 483
Location: Belgium
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
the code i post falls under the: WTFYW-WTFPL license


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 23rd, 2010, 10:17 am 
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 23rd, 2010, 10:23 am 
Sorry guys, I haven't got an Account here, yet.

I wanted to edit sth:

Why the Email I get is so big? :D
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 =)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 23rd, 2010, 1:58 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
those are configuration settings you dont need to understand you just need to use them

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 26th, 2010, 6:30 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
Quote:
And like sb has asked her before
Who is her? Are you a female?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 18th, 2010, 3:09 pm 
I get this com error every time i run the script!

Image


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 18th, 2010, 3:16 pm 
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!

Image


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 20th, 2010, 7:21 pm 
Hello Sean,

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

Thanks


Report this post
Top
  
Reply with quote  
 Post subject: solution..
PostPosted: November 29th, 2010, 8:19 pm 
Offline

Joined: September 15th, 2006, 10:25 am
Posts: 567
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()


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 20th, 2010, 11:43 am 
Offline

Joined: May 12th, 2007, 8:29 am
Posts: 48
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:
Image

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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 20th, 2010, 12:14 pm 
Offline

Joined: September 15th, 2006, 10:25 am
Posts: 567
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"


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 20th, 2010, 12:35 pm 
Offline

Joined: May 12th, 2007, 8:29 am
Posts: 48
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 20th, 2010, 12:54 pm 
Offline

Joined: September 15th, 2006, 10:25 am
Posts: 567
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.


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Kirtman and 13 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