<%
Function sendMail(strTo, strFrom, strSubject, strBody)
On Error Resume Next
Set iConf = Server.CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
Flds("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.xxxx.com" ' 메일서버 IP
Flds("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 ' 포트번호
Flds("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 ' cdoSendUsingPort
Flds("http://schemas.microsoft.com/cdo/configuration/smtpaccountname") = "master@xxxx.com" ' 계정이름
Flds("http://schemas.microsoft.com/cdo/configuration/sendemailaddress") = """관리자"" <master@xxxx.com>"
Flds("http://schemas.microsoft.com/cdo/configuration/smtpuserreplyemailaddress")= """관리자"" <master@xxxx.com>"
Flds("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'cdoBasic
Flds("http://schemas.microsoft.com/cdo/configuration/sendusername") = "master@xxxx.com" ' 계정ID
Flds("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "xxxx" ' 비밀번호
Flds.Update
Set Flds = Nothing
Set iMsg = Server.CreateObject("CDO.Message")
With iMsg
.Configuration = iConf
.To = strTo ' 받는넘
.From = strFrom ' 보내는넘
.Subject = strSubject ' 제목
.HTMLBody = strBody ' 내용
.Send
End With
Set iMsg = Nothing
Set iConf = Nothing
If Err Then
Response.Clear
Response.write "Error Number : " & Err.number & "<br>" & _
"Error Source : " & Err.Source & "<br>" & _
"Error Descryption : " & Err.Description
Response.End
Else
'Response.Write "메일이 정상적으로 발송되었습니다"
End If
End Function
%>
[출처] [본문스크랩] asp 에서 외부 smtp 이용 메일 보내기 (플그램밍) |작성자 분노의칼