Отправлять почту из iOS с Outlook [duplicate]

Это вернет набор данных, где не более двух значений для каждой строки:

dfrm[ apply(dfrm, 1, function(r) sum(is.na(x)) <= 2 ) , ]
4
задан rmaddy 17 October 2015 в 19:49
поделиться

1 ответ

Вот ссылка, которую я нашел, которая помогла мне с схемой URL-адресов Outlook IOS .

Из этого я смог найти этот код:

// Create an array of recipients for the email.
NSArray* emailRecipients = @[@"example@email.com", @"example2@email.com"];

// Create a mutable string to hold all of the recipient email addresses and add the first one.
NSMutableString* emailTo = [[NSMutableString alloc] initWithString:emailRecipients[0]];
// Loop through all of the email recipients except for the first one.
for (int index = 1; index < emailRecipients.count; index++)
{
    // Add a semicolon and then the email address at the current index.
    [emailTo appendFormat:@";%@", emailRecipients[index]];
}

// Get the email subject from the subject text field.
NSString* emailSubject = fieldSubject.text;
// Encode the string for URL.
NSString* encodedSubject = [emailSubject stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLHostAllowedCharacterSet]];
// Get the email body from the body text field.
NSString* emailBody = fieldBody.text;
// Encode the string for URL.
NSString* encodedBody = [emailBody stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLHostAllowedCharacterSet]];

// See if the subject or body are empty.
if (![emailSubject length] || ![emailBody length])
{
    // Exit.
    return;
}

// Create a string with the URL scheme and email properties.
NSString *stringURL = [NSString stringWithFormat:@"ms-outlook://compose?to=%@&subject=%@&body=%@", emailTo, encodedSubject, encodedBody];
// Convert the string to a URL.
NSURL *url = [NSURL URLWithString:stringURL];
// Open the app that responds to the URL scheme (should be Outlook).
[[UIApplication sharedApplication] openURL:url];

Схема URL для Outlook: ms-outlook: // compose? to=example@email.com& subject = Subject & amp; body = Message

Надеюсь, что это поможет!

8
ответ дан Community 21 August 2018 в 22:55
поделиться
  • 1
    Я нашел ваш ответ действительно полезным. Единственное, чего не хватает в этом, это вложение. Вы можете помочь? – Mohammed Akhtar Zuberi 21 May 2017 в 09:39
  • 2
    @Moh Любая удача с приложением? – Cam 31 July 2018 в 17:29
  • 3
    Я не могу сказать наверняка, но я не думаю, что это возможно с помощью схемы URL. Взаимодействие с документами можно найти в следующем вопросе: stackoverflow.com/questions/8876648/… . – King Tech 2 August 2018 в 01:15
Другие вопросы по тегам:

Похожие вопросы: