Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (IBAction)sendEmail:(id)sender {
- MCOMessageBuilder *builder = [[MCOMessageBuilder alloc] init];
- MCOAddress *address = [MCOAddress addressWithDisplayName:@"Uplant Support" mailbox:@"noreply.uplant@gmail.com"];
- NSArray *to = [NSArray arrayWithObject:[MCOAddress addressWithDisplayName:@"Glenn Posadas" mailbox:@"admin@glennvon.com"]];
- [[builder header] setFrom:address];
- [[builder header] setTo:to];
- [[builder header] setSubject:@"This is a nice subject"];
- [builder setHTMLBody:@"The motherloving body."];
- NSData * data = [builder data];
- MCOSMTPSession *smtpSession = [[MCOSMTPSession alloc] init];
- [smtpSession setHostname:@"smtp.gmail.com"];
- [smtpSession setUsername:@"noreply.uplant@gmail.com"];
- [smtpSession setPassword:@"----"];
- [smtpSession setPort:465];
- [smtpSession setConnectionType:MCOConnectionTypeTLS];
- MCOSMTPSendOperation *smtpSender = [smtpSession sendOperationWithData: data];
- [smtpSender start:^(NSError * _Nullable error) {
- NSLog(@"Error: %@", error.localizedDescription);
- }];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement