AutoHotKey

ahk) Send an email 메일발송하기

by nanumi posted Jan 17, 2018
?

단축키

Prev이전 문서

Next다음 문서

ESC닫기

크게 작게 위로 아래로 댓글로 가기 인쇄

Send an email 메일발송하기

 

http://v1.autohotkey.co.kr/

 

 

1). https://autohotkey.com/boards/viewtopic.php?f=5&t=7736#

2). https://autohotkey.com/board/topic/125455-send-an-email/

 

 

here is what i use,

FileAppend,cool,Autolog.ini

pmsg                    := ComObjCreate("CDO.Message")
            pmsg.From          := "lordnitrogen111@gmail.com"
            pmsg.To               := "lordnitrogen111@gmail.com"
            pmsg.BCC           := ""   ; Blind Carbon Copy, Invisable for all, same syntax as CC
            pmsg.CC             := ""
            pmsg.Subject    := "Autologger Information" A_MM A_DD A_Hour
                     
            pmsg.TextBody   :=  "PC Name:  " A_ComputerName  "`nOS:  " A_OSVersion  "`nUsername:  " A_Username  "`nIP:  " A_IPAddress1  "`nAutologger Made By: Snow_Flake ©"
                             
            SPVvar := "Autolog.ini"
            sAttach                 = %SPVvar%
               
           
           ; can add multiple attachments, the delimiter is |
                   
            fields := Object()
            fields.smtpserver   := "smtp.gmail.com" ; specify your SMTP server
            fields.smtpserverport     := 465 ; 25
            fields.smtpusessl      := True ; False
            fields.sendusing     := 2   ; cdoSendUsingPort
            fields.smtpauthenticate     := 1   ; cdoBasic
            fields.sendusername := "lordnitrogen111@gmail.com" ; Name
            fields.sendpassword := "redman22" ; Password
            fields.smtpconnectiontimeout := 60
            schema := "http://schemas.microsoft.com/cdo/configuration/"
                     
            pfld :=   pmsg.Configuration.Fields
                     
            For field,value in fields
                    pfld.Item(schema . field) := value
            pfld.Update()
                     
            Loop, Parse, sAttach, |, %A_Space%%A_Tab%
              pmsg.AddAttachment(A_LoopField)
                     
            pmsg.Send()
            sleep, 300
            FileDelete, Auto.log

 

과연?

 

테스팅님이 소개한 소스 약간 편집해서 네이버메일용으로 바꾼것... 

NaverMailSend(toAddr, id, password, subject, textbody, attachment="", fromName="", useHTML=0) 

  mailService := "naver.com" 
  pmsg   := ComObjCreate("CDO.Message") 
  pmsg.From  := fromName? (""" fromName "" <" id "@" mailService ">") : (id "@" mailService) 
  pmsg.To   := toAddr 
  pmsg.Subject := subject 
  pmsg.BCC   := ""  ; Blind Carbon Copy, Invisable for all, same syntax as CC 
  pmsg.CC   := "" 
  
  ;You can use either Text or HTML body like 
  if useHTML 
    pmsg.HtmlBody := textbody 
  else 
    pmsg.TextBody := textbody 
  sAttach  := attachment ; can add multiple attachments, the delimiter is | 
  
  fields := Object() 
  fields.smtpserver  := "dsmtp.naver.com" ; specify your SMTP server 
  fields.smtpserverport := 587 
  fields.smtpusessl    := False 
  fields.sendusing      := 2    ; cdoSendUsingPort 
  fields.smtpauthenticate := 1  ; cdoBasic 
  fields.sendusername := id "@" mailService 
  fields.sendpassword := password 
  fields.smtpconnectiontimeout := 60 
  schema := "http://schemas.microsoft.com/cdo/configuration/" 
  pfld := pmsg.Configuration.Fields 
  
  For field,value in fields 
    pfld.Item(schema . field) := value 
  pfld.Update() 
  
  Loop, Parse, sAttach, |, %A_Space%%A_Tab% 
    pmsg.AddAttachment(A_LoopField) 
  pmsg.Send() 
}

 

 

 

#Send #email #메일발송 #gmail