Tutorials/LateBinding: cdotest.d

File cdotest.d, 1.5 kB (added by John, 4 years ago)
Line 
1 import juno.com.core, juno.com.client;
2
3 void main() {
4   // Create an instance of the Message object
5   scope message = new DispatchObject("CDO.Message");
6
7   // Build the mail message
8   message.set("Subject", "Hello, World!");
9   message.set("TextBody", "Just saying Hello.");
10   message.set("From", "me@home.com"); // Replace 'me@home.com' with your email address
11   message.set("To", "world@large.com"); // Replace 'world@large.com' with the recipient's email address
12
13   // Configure CDOSYS to send via a remote SMTP server
14
15   scope config = message.get("Configuration");
16
17   // Set the appropriate values
18   config.set("Fields", "http://schemas.microsoft.com/cdo/configuration/sendusing", 2); // cdoSendUsingPort = 2
19
20   config.set("Fields", "http://schemas.microsoft.com/cdo/configuration/smtpserverport", 25);
21
22   config.set("Fields", "http://schemas.microsoft.com/cdo/configuration/smtpserver", "mail.remote.com"); // Replace 'mail.remote.com' with your remote server's address
23
24   // Set the authentication type, user name and password
25
26   config.set("Fields", "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", 1); // cdoBasic = 1
27
28   config.set("Fields", "http://schemas.microsoft.com/cdo/configuration/sendusername", "username"); // Replace 'username' with your account's user name
29
30   config.set("Fields", "http://schemas.microsoft.com/cdo/configuration/sendpassword", "password"); // Replace 'password' with your account's password
31
32   scope fields = config.get("Fields");
33   fields.call("Update");
34
35   message.call("Send");
36 }