相关疑难解决方法(0)

使用Swift发送电子邮件

你会如何在应用程序中发送swift电子邮件?比如说,例如你的用户希望在Parse(或不是)的社交媒体应用程序中重置他们的密码,但是你不想使用MessageUI,因为你希望它是自动的.我已经做了一些研究,发现它可以用mailgun,但我无法弄清楚如何使用它与swift和XCode 6.你能帮帮我吗?

email ios parse-platform mailgun swift

41
推荐指数
2
解决办法
4万
查看次数

在Swift中发送Mailcore2普通电子邮件

我最近将MailCore2合并到了我的Objective-C项目中,并且它运行得很好.现在,我正在将应用程序中的代码转换为Swift.我已成功将MailCore2 API导入到我的swift项目中,但我没有看到如何将以下工作的Objective-C代码转换为Swift代码的文档(Google搜索,libmailcore.com,github):

MCOSMTPSession *smtpSession = [[MCOSMTPSession alloc] init];
smtpSession.hostname = @"smtp.gmail.com";
smtpSession.port = 465;
smtpSession.username = @"matt@gmail.com";
smtpSession.password = @"password";
smtpSession.authType = MCOAuthTypeSASLPlain;
smtpSession.connectionType = MCOConnectionTypeTLS;

MCOMessageBuilder *builder = [[MCOMessageBuilder alloc] init];
MCOAddress *from = [MCOAddress addressWithDisplayName:@"Matt R"
                                              mailbox:@"matt@gmail.com"];
MCOAddress *to = [MCOAddress addressWithDisplayName:nil 
                                            mailbox:@"hoa@gmail.com"];
[[builder header] setFrom:from];
[[builder header] setTo:@[to]];
[[builder header] setSubject:@"My message"];
[builder setHTMLBody:@"This is a test message!"];
NSData * rfc822Data = [builder data];

MCOSMTPSendOperation *sendOperation = 
   [smtpSession sendOperationWithData:rfc822Data];
[sendOperation start:^(NSError *error) {
    if(error) {
        NSLog(@"Error sending …
Run Code Online (Sandbox Code Playgroud)

api objective-c mailcore mailcore2 swift

12
推荐指数
2
解决办法
9087
查看次数

iOS App - 使用Swift在后台发送邮件

我有一个应用程序,我有一个简单的表单来收集数据,然后想要将包含该数据的电子邮件发送到特定的电子邮件地址.

理想情况下,我只是希望这对用户透明 - 他们只需按提交/发送,电子邮件将自动创建并在后台发送到该电子邮件地址,用户不知道.

我正在使用Objective-C获得这方面的教程,但我想使用Swift实现它.

是否有推荐的方式在后台发送电子邮件?

email smtp ios swift

5
推荐指数
1
解决办法
4786
查看次数

标签 统计

swift ×3

email ×2

ios ×2

api ×1

mailcore ×1

mailcore2 ×1

mailgun ×1

objective-c ×1

parse-platform ×1

smtp ×1