Skip to content
This repository
Browse code

Updated the example to use the latest SMTP code

commit 80011253ef3addbff99a78f48b80c4932582dee5 1 parent 3449724
Matt Ronge authored November 24, 2012
15  Examples/OSX/MessageSender/MessageSender/CTMyController.m
@@ -18,7 +18,10 @@ - (IBAction)sendMessage:(id)sender {
18 18
     [msg setBody:body.stringValue];
19 19
 
20 20
     BOOL auth = ([useAuth state] == NSOnState);
21  
-    BOOL tls = ([useTLS state] == NSOnState);
  21
+    CTSMTPConnectionType connectionType = CTSMTPConnectionTypePlain;
  22
+    if ([useTLS state] == NSOnState) {
  23
+        connectionType = CTSMTPConnectionTypeStartTLS;
  24
+    }
22 25
     
23 26
     NSString *serverValue = server.stringValue;
24 27
     NSString *usernameValue = username.stringValue;
@@ -27,8 +30,14 @@ - (IBAction)sendMessage:(id)sender {
27 30
     
28 31
     dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
29 32
         NSError *error;
30  
-        BOOL success = [CTSMTPConnection sendMessage:msg server:serverValue username:usernameValue
31  
-                                            password:passwordValue port:portValue useTLS:tls useAuth:auth error:&error];
  33
+        BOOL success = [CTSMTPConnection sendMessage:msg
  34
+                                              server:serverValue
  35
+                                            username:usernameValue
  36
+                                            password:passwordValue
  37
+                                                port:portValue
  38
+                                      connectionType:connectionType
  39
+                                             useAuth:auth
  40
+                                               error:&error];
32 41
         if (!success) {
33 42
             dispatch_async(dispatch_get_main_queue(), ^{
34 43
                 [NSApp presentError:error];

0 notes on commit 8001125

Please sign in to comment.
Something went wrong with that request. Please try again.