Set Jmail = New SMTPMail
Jmail.ServerAddress = "<>"
Jmail.Sender = "<
Jmail.ReplyTo = "<
Jmail.AddRecipientEx "<
Jmail.Subject = "Testing the excellent jmail"
Jmail.Priority = 1
Jmail.Body = "Body and soul." & vbCrLf & "Way cool..."
Jmail.AddAttachment "c:\windows\desktop\test.doc"
Jmail.Execute
Set Jmail = Nothing
SQL 방식
exec @hr = sp_OACreate 'jmail.smtpmail', @object OUT
exec @hr = sp_OASetProperty @object, 'Sender', @sender
exec @hr = sp_OASetProperty @object, 'ServerAddress', @serveraddress
exec @hr = sp_OAMethod @object, 'AddRecipient', NULL , @recipient
exec @hr = sp_OASetProperty @object, 'Subject', @subject
exec @hr = sp_OASetProperty @object, 'Body', @mailbody
exec @hr = sp_OAMethod @object, 'execute', NULL
exec @hr = sp_OAGetErrorInfo @object, @source OUT, @description OUT
if @hr = 0
begin
select @output = ' Source: ' + @source
print @output
select @output = ' Description: ' + @description
print @output
end
else
begin
print ' sp_OAGetErrorInfo failed.'
return
end
댓글 없음:
댓글 쓰기