ASP 메일발송 샘플
- ASP 메일 입력 폼
- ASP 메일 발송 소스
ASP 메일 입력 폼
- JQUERY
- BLOCKUI
- 소스
<%'mail_send01.asp%>
<html>
<head>
<script type="text/javascript" src="/js/jquery-1.7.2.js"></script>
<script type="text/javascript" src="/js/jquery.blockUI.js"></script>
<script type="text/javascript">
function fnSendEmail() {
var emailStr = document.getElementById("email");
if(!emailStr || !emailStr.value) {
alert("email 입력 필수!!");
return;
} else {
$("body").block({ css: {
border: 'none',
padding: '15px',
backgroundColor: '#000',
'-webkit-border-radius': '10px',
'-moz-border-radius': '10px',
opacity: .5,
color: '#fff'
} });
location.href="mail_send02.asp?email=" + emailStr.value;
}
}
</script>
</head>
<body>
<input type="text" name="email" id="email" size="30" value="<%=request("email")%>">
<input type="button" name="btnEmail" id="btnEmail" value="메일링 테스트 발송" onclick="fnSendEmail();">
</body>
</html>
ASP 메일 발송 소스
- CDO
- 소스
<%
' mail_send02.asp
mailcontents = ""
mailcontents=mailcontents & chr(10) & " <html> "
mailcontents=mailcontents & chr(10) & " <head> "
mailcontents=mailcontents & chr(10) & " <title>ASP 메일보내기 TEST</title> "
mailcontents=mailcontents & chr(10) & " <meta http-equiv=""Content-Type"" content=""text/html; charset=euc-kr""> "
mailcontents=mailcontents & chr(10) & " </head> "
mailcontents=mailcontents & chr(10) & " "
mailcontents=mailcontents & chr(10) & " <body> "
mailcontents=mailcontents & chr(10) & " <h1>MAIL TEST 입니다.</h1> "
mailcontents=mailcontents & chr(10) & " </body> "
mailcontents=mailcontents & chr(10) & " </html> "
sendmail = sender
subject = "메일 테스트 입니다."
content = mailcontents
Dim iMsg
Dim iConf
Set iConf = Server.CreateObject("CDO.Configuration")
With iConf.Fields
.item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 '1일 경우 로컬(SMTP), 2일 경우 외부(SMTP)로 메일전송
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory") = "C:\Inetpub\mailroot\Pickup"
.item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "xxx.xxx.xxx.xxx" 'Host 설정
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 30
'.item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 'port
'.item("http://schemas.microsoft.com/cdo/configuration/smtpaccountname") = "webmaster@test.com" '계정이름
'.item("http://schemas.microsoft.com/cdo/configuration/sendmailaddress") = "webmaster@test.com" '
'.item("http://schemas.microsoft.com/cdo/configuration/smtpuserreplyemailaddress") = "webmaster@test.com" '
'.item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'cdo basic
'.item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "webmaster@test.com" '메일서버 계쩡 ID
'.item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "webmaster@test.com" '메일서버 계정 비밀번호
.Update
End With
'CDO 메시지 개체 생성
Set iMsg = Server.CreateObject("CDO.Message")
iMsg.Configuration = iConf
Set iConf = Nothing
email_str = request("email") '메일 주소
With iMsg
'.BodyPart.Charset = "ks_c_5601-1987" '한글설정
.To = email_str
.From = "test@test.com"
.Subject = subject
.HtmlBody = content
'.CC = "test@test.com" ' 참조주소
.Send
End With
Set iMsg = Nothing
%>
<script type="text/javascript">
alert("메일이 발송되었습니다");
location.href="mail_send01.asp?email=<%=email_str%>";
</script>
참고url
http://fendee.egloos.com/10846218
(CDO 속성 관련 참고 URL)