Is there any way to set an email subject line for say a document at
http://www.mydomain.com/Download.aspx?InstanceID=1087&Type=doc
Now when I hit share and try to send it from an iPad, the subject line is:
"http://www.mydomain.com/Download.aspx?InstanceID=1087&Type=doc"
When it should be customized by document: "Application Form", "Waiver Form", etc.
Do I set this in acrobat (it is a pdf) or is there some code I can use?
Thanks
Check below code for the email for setting up your email subject:
UIActivityViewController* avc = [[UIActivityViewController alloc] initWithActivityItems:#[#"Your String to share"]
applicationActivities:nil];
[avc setValue:#"Your email Subject" forKey:#"subject"];
avc.completionHandler = ^(NSString *activityType, BOOL completed) {
// ...
};
Here the line
[avc setValue:#"Your email Subject" forKey:#"subject"];
Makes the subject as "Your email Subject" if user picks email option in the UIActivityViewController.
I hope it helps...
Related
I am sharing Some content via UIActivityController.
It is working fine for other Options.
I am able to get subject and body in Default Mail App.
But when I use to share the content with gmail then my Subject of the mail is gone and I am getting Body content in Gmail Subject's section:
Here is my code:
NSString *body = #"I am Body";
NSString *tagLine = #"I am Subject";
NSArray *objectToShare = [NSArray arrayWithObjects:body, nil];
UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:objectToShare applicationActivities:nil];
[activityVC setValue:tagLine forKey:#"subject"];
NSArray *excludeActivities = #[UIActivityTypeAirDrop,
UIActivityTypePrint,
UIActivityTypeAssignToContact,
UIActivityTypeSaveToCameraRoll,
UIActivityTypeAddToReadingList,
UIActivityTypePostToVimeo];
activityVC.excludedActivityTypes = excludeActivities;
[self presentViewController:activityVC animated:YES completion:nil];
For better Picture Here is the screenshot:
With Default App:
With Gmail:
I also tried different answers on SO. But none of them works.
At the time of writing this, Google doesn't allow setting the subject of email. People have reported it as a bug multiple times, and it seems this feature is still not supported.
Looking at other Google-owned products, and trying to share some contents via Gmail, you will see that the Gmail shared activity doesn't have the subject (e.g Google Chrome), or it's the same as the email's body (Google Translator), while if you share them to the normal app it appears that some of them have a subject. So even Google products have the same behaviour.
If you use a breakpoint inside the subjectForActivityType function you will realise that the Gmail activity won't hit the breakpoint while default mail and other activities will attempt to read the subject.
#implementation EmailItemProvider
- (id)activityViewControllerPlaceholderItem:(UIActivityViewController *)activityViewController {
return _body;
}
- (id)activityViewController:(UIActivityViewController *)activityViewController itemForActivityType:(NSString *)activityType {
return _body;
}
- (NSString *)activityViewController:(UIActivityViewController *)activityViewController subjectForActivityType:(NSString *)activityType {
return _subject;
}
I am new in iOS programming, I know this is too old question but I am confused here about message controller. I want to make a application in which I want to send simple messages.
if I set multiple recipients can any of one can you view all recipients?
if it so,then how can I make a private message for all so that one recipient can't view other recipients?
Here is my code for composing a message for more recipients
- (void)showSMS:(NSString*)file {
if(![MFMessageComposeViewController canSendText]) {
UIAlertView *warningAlert = [[UIAlertView alloc] initWithTitle:#"Error" message:#"Your device doesn't support SMS!" delegate:nil cancelButtonTitle:#"OK" otherButtonTitles:nil];
[warningAlert show];
return;
}
NSArray *recipents = #[#"12345678", #"72345524"];
NSString *message = [NSString stringWithFormat:#"Just sent the %# file to your email. Please check!", file];
MFMessageComposeViewController *messageController = [[MFMessageComposeViewController alloc] init];
messageController.messageComposeDelegate = self;
[messageController setRecipients:recipents];
[messageController setBody:message];
[self presentViewController:messageController animated:YES completion:nil];
}
There's a setting in Settings -> Messages which disables group messaging, and all recipients will receive the messages separately. Other than that, you can't do it with MFMessageComposeViewController because there's no bcc option. Your could send the messages one at a time though
I want to send the email from my iOS device programtically using iOS.I am using the below code to send the email but i don't know where to enter from field.From which email id the mail will be sent?
Code for Sending email in iOS
// Email Subject
if(![MFMailComposeViewController canSendMail])
{
UIAlertView *warningAlert = [[UIAlertView alloc] initWithTitle:#"Error" message:#"Your device doesn't support Email!" delegate:nil cancelButtonTitle:#"OK" otherButtonTitles:nil];
[warningAlert show];
return;
}
NSString *emailTitle = #"Test Email";
// Email Content
NSString *messageBody = #"iOS programming is so fun!";
// To address
NSArray *toRecipents = [NSArray arrayWithObject:#"support#appcoda.com"];
MFMailComposeViewController *mc = [[MFMailComposeViewController alloc] init];
mc.mailComposeDelegate = self;
[mc setSubject:emailTitle];
[mc setMessageBody:messageBody isHTML:NO];
[mc setToRecipients:toRecipents];
// Present mail view controller on screen
[self presentViewController:mc animated:YES completion:NULL];
Just to add, one other thing you can't do using the built-in MFMailComposeViewController class is to send emails silently, without the full-screen "Compose email" view appearing.
In my app, I resorted to sending the email details (To address, Body text, etc) to my app's WCF web service, and getting that to send the email instead.
And, of course, doing it that way, you can choose which From address you wish to use.
You cannot actually set the From field when using the MFMailComposeViewController. What actually happens is the From field will default to whatever email account the user has specified to be used as the default email account on the device in the settings.
I am trying to open my app via the Facebook app's status but my link shows up as text instead of a link. It does works with both SMS and Email but does not FB or Twitter status'.
I have a URL Scheme set up in my Info.plist.
My link is (appName is my URL Scheme name given)
Also I am calling FB, Twitter, & everything else with
UIActivityViewController *activityController = [[UIActivityViewController alloc] initWithActivityItems:sharingItems applicationActivities:nil];
[activityController setCompletionHandler:^(NSString *activityType, BOOL completed)
{
bubbleTable.typingBubble = NSBubbleTypingTypeNobody;
NSBubbleData *sayBubble = [NSBubbleData dataWithText:textField.text date:[NSDate dateWithTimeIntervalSinceNow:0] type:BubbleTypeMine];
[bubbleData addObject:sayBubble];
[bubbleTable reloadData];
textField.text = #"";
NSLog(#"%#, %d", activityType, completed);
}];
[self presentViewController:activityController animated:YES completion:nil];
Trying to keep everything native to iOS.
Have a look at https://developers.facebook.com/docs/applinks for your Use Case.
I am sending email via following method:
-(void) sendEmailOpenControllerWithSubject:(NSString *)subject messsageBody:(NSString *) message
{
MFMailComposeViewController* controller = [[MFMailComposeViewController alloc] init];
controller.mailComposeDelegate = self;
[controller setSubject:subject];
[controller setMessageBody:message isHTML:NO];
[controller setToRecipients:[[NSArray alloc] initWithObjects:currentProspect.email, nil]];
if (controller) [self presentModalViewController:controller animated:YES];
}
I am setting message body subject and recipient but it is likely that user changes these attribute in MailComposer.
What I need:
So I want to get the contents like message body,subject and recipients after the email is sent. As it is possible that user has changed these via mail composer.
Starting in iOS 5, you can register to be notified of changes to the availability of text message sending.
A userInfo dictionary key for the MFMessageComposeViewControllerTextMessageAvailabilityDidChangeNotification
NSString *const MFMessageComposeViewControllerTextMessageAvailabilityKey;
Refer more on Message UI Framework here