-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsendmail.vbs
More file actions
28 lines (25 loc) · 829 Bytes
/
sendmail.vbs
File metadata and controls
28 lines (25 loc) · 829 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
function sendmail( fromaddr, toaddr, subject, body, smtpservername, smtpserverport )
Set objEmail = CreateObject( "CDO.Message" )
With objEmail
.From = fromaddr
.To = toaddr
.Subject = subject
.TextBody = body
root = "http://schemas.microsoft.com/cdo/configuration/"
With .Configuration.Fields
.Item( root & "sendusing" ) = 2
.Item( root & "smtpserver" ) = smtpservername
.Item( root & "smtpserverport" ) = smtpserverport
.Update
End With
on error resume next
.Send
'wscript.echo "result:(" & err.description
End With
' Return status message
If Err Then
sendmail = err.description
Else
sendmail = ""
End If
end function