티스토리 뷰

<%
Function GoogleSendMail(strTo, strFrom, strSubject, strBody)
On Error Resume Next

Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields

schema = "http://schemas.microsoft.com/cdo/configuration/"
Flds.Item(schema & "sendusing") = 2
Flds.Item(schema & "smtpaccountname") = "홍길동 <홍길동@gmail.com>"
Flds.Item(schema & "sendemailaddress") = "홍길동 <홍길동@gmail.com>"
Flds.Item(schema & "smtpuserreplyemailaddress") = "홍길동 <홍길동@gmail.com>"
Flds.Item(schema & "smtpserver") = "smtp.gmail.com" 
Flds.Item(schema & "smtpserverport") = 465
Flds.Item(schema & "smtpauthenticate") = 1
Flds.Item(schema & "sendusername") = "홍길동@gmail.com"
Flds.Item(schema & "sendpassword") = "메일암호"
Flds.Item(schema & "smtpusessl") = 1
Flds.Update

Set Flds = Nothing
Set iMsg =  Server.CreateObject("CDO.Message")
With iMsg
  .Configuration = iConf
  .To       = strTo                 ' 받는넘
  .From     = strFrom            ' 보내는넘
  .Subject  = strSubject         ' 제목      
  .HTMLBody = strBody        ' 내용
  SendEmailGmail = .Send
End With

set iMsg = nothing
set iConf = nothing
set Flds = nothing

If Err.number <> 0 Then
  GoogleSendMail = Err.Description
Else
  GoogleSendMail = 0
End If

End Function
%>

<%
  ' 사용예
  Ret = GoogleSendMail("받은사람 이메일", "홍길동 <홍길동@gmail.com>", "제목이구", "내용이얌")  
%>

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/12   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
글 보관함