Function eMailCDOSend(MailTitle As String, MailTag As String, Sender As String, Receiver As String, addFile As String) As Boolean ' MailTitle : 제목 ' MailTag : html내용 ' Sender : 보내는 사람 ' Receiver : 받는사람 Dim eMailObject, eMailConfig Dim SchemaPath eMailObject = Server.CreateObject("CDO.Message") eMailConfig = Server.CreateObject("CDO.Configuration") SchemaPath = "http://schemas.microsoft.com/cdo/configuration/" Try With eMailConfig.Fields .Item(SchemaPath & "sendusing") = 2 'CDOSendUsingPort .Item(SchemaPath & "smtpserver") = "127.0.0.1" 'CDOSendUsingPort [ServerIP] .Item(SchemaPath & "smtpserverport") = "325" 'Port .Update End With eMailObject.Configuration = eMailConfig eMailConfig = Nothing If addFile <> "" Then eMailObject.To = Receiver eMailObject.From = Sender eMailObject.Subject = MailTitle eMailObject.HTMLBody = MailTag eMailObject.BodyPart.Charset = "ks_c_5601-1987" eMailObject.HTMLBodyPart.Charset = "ks_c_5601-1987" eMailObject.HTMLBodyPart.ContentTransferEncoding = "quoted-printable" eMailObject.AddAttachment(addFile) eMailObject.fields.update eMailObject.Send Else With eMailObject .From = Sender .To = Receiver .Subject = MailTitle .HTMLBody = MailTag .BodyPart.Charset = "ks_c_5601-1987" .HTMLBodyPart.Charset = "ks_c_5601-1987" .HTMLBodyPart.ContentTransferEncoding = "quoted-printable" .Send End With End If eMailObject = Nothing Catch ex As Exception Return False End Try Return True End Function
16. 10. 24.
VB.NET Email 전송
피드 구독하기:
댓글 (Atom)
댓글 없음:
댓글 쓰기