ローカルネットワークで正常に動作する以下のコードがあります。しかし、ログインしていなくても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