Function SendMail(SendFrom,SendTo,Subject,Body,Attachment)
On Error Resume Next
Set OutLook=CreateObject("Outlook.Application")' CDONTS
Set Mail=OutLook.CreateItem(0)
Mail.From=SendFrom
Mail.To=SendTo
Mail.Subject=Subject
Mail.Body=Body
If (Attachment<>"") Then
Mail.Attachments.Add(Attachment)
Mail.Send
'if window pop while sending mail, that will handled by the following code
Dialog("Microsoft Office Outlook").Activate
Dialog("Microsoft Office Outlook").WinButton("Yes").Click
OutLook.Quit
Set OutLook=Nothing
Set Mail=Nothing
End If
On Error GoTo 0
End Function
No comments:
Post a Comment