我有以下代码在本地网络中运行良好。但我希望相同的功能适用于通过 vpn 连接的远程机器,即使我没有登录也是如此。
Function Sendmail()
Dim objMessage
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Checking for latest file"
objMessage.From = "d@tkd.com"
objMessage.To = "s@tkd.com"
objMessage.TextBody = "This is to intimate you regrding latest File........."
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.tkd.com"
'Type of authentication, NONE, Basic (Base64 encoded), NTLM
objMessage.Configuration.Fields.Item _
( "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate" ) = cdoBasic
'Your UserID on the SMTP server
objMessage.Configuration.Fields.Item _
( "http://schemas.microsoft.com/cdo/configuration/sendusername" ) = "deepika@tecknodreams.com"
'Your password on the SMTP server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "123"
'Server Port
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
'Use SSL for the connection (False or True)
objMessage.Configuration.Fields.Item _
( "http://schemas.microsoft.com/cdo/configuration/smtpusessl" ) = False
'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)
objMessage.Configuration.Fields.Item _
( "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout" ) = 60
objMessage.Configuration.Fields.Update
objMessage.Send
End Function