如果允许,如何获取邮件配置信息?

时间:2014-04-20 05:53:43

标签: ios objective-c email sendmail

您好我正在使用SMTP服务器框架发送邮件。

NSArray *arr1 = [testMsg.fromEmail componentsSeparatedByString:@"@"];
NSArray *arr2 = [[arr1 objectAtIndex:1] componentsSeparatedByString:@"."];

if ([arr2 containsObject:@"gmail"]) {
    testMsg.relayHost = @"smtp.gmail.com";
}
else if ([arr2 containsObject:@"yahoo"]) {
    testMsg.relayHost = @"smtp.mail.yahoo.com";
}
else if ([arr2 containsObject:@"hotmail"] || [arr2 containsObject:@"live"]) {
    testMsg.relayHost = @"smtp.live.com";
}
else
{
    NSString *smtpRelay = [[NSString alloc]init];
    smtpRelay = [NSString stringWithFormat:@"smtp.%@.com",[arr2 objectAtIndex:0]];
    testMsg.relayHost = smtpRelay;
}

testMsg.requiresAuth = YES;
testMsg.login = @"mycompanyUserName@mycompany.com";
testMsg.password = @"********";
testMsg.subject = @"This is the email subject line";
testMsg.wantsSecure = YES; // smtp.gmail.com doesn't work without TLS!

如果我想从我的办公室ID或其他人发送邮件,我想自动获取在MAIL应用程序中配置的邮件信息。

所以我可以从配置的邮件(在设备中)发送邮件。是否可以获得这样的信息...如果允许....请帮助我......我不想要用户输入ID和密码...提前致谢

0 个答案:

没有答案