I am creating a windows phone 8 app. I have created a PDF document and now I want to send this PDF to an email address. But I do not know how to proceed with this.
Please Help me.
Thanks,
(First search search search then ask)
see this one MSDN:
To send normal email,you should add:
using Microsoft.Phone.Tasks;
to your code, and then for personalizing and going to the mail app add this:
EmailComposeTask emailComposeTask = new EmailComposeTask();
emailComposeTask.Subject = "message subject";
emailComposeTask.Body = "message body";
emailComposeTask.To = "recipient#example.com";
emailComposeTask.Cc = "cc#example.com";
emailComposeTask.Bcc = "bcc#example.com";
emailComposeTask.Show();
for sending attachemnts see these links once
end-email-with-attachments-without-using-emailcomposetask-with-mailmessage
how-to-send-automated-emails-with-attachments-from-windows-phone-apps
Related
I'm trying to create a windows store app that will launch the default mail app (WinJS 8.1). I haven't touched this for a while, but it was working correctly before 8 - 8.1 upgrade. The code looks like this:
var interval = setInterval(function () {
clearInterval(interval);
var formattedBodyText = bodyText.replace(/\n/g, '%0d');
var mailTask = Email.SendNewMail.sendEmail(emailAddress, subject, formattedBodyText);
}, 500);
And the sendEmail function:
sendEmail: function sendEmail(addess, subject, body) {
var mailto = new Windows.Foundation.Uri("mailto:?to=" + addess + "&subject=" + subject + "&body=" + body);
return Windows.System.Launcher.launchUriAsync(mailto);
}
Oddly, this seems to launch Chrome (I assume because that's my default browser). How can I get it to launch the mail app? Has this changed since the 8.1 upgrade?
EDIT:
It looks like the default program for opening mails was changed to Chrome. So, I suppose my question is now: is it possible to FORCE the mail app to open, rather than whatever is associated with the mailto: url? I noticed there was an ms-mail uri - would that be safer to use?
You can't determine which is default mail app in Windows Store app. Moreover there's no way to open Mail app forcefully in Windows Store app. It doesn't make sense. Some user (Like me!) might not like default mail app. So I would recommend to stick to share charm for sending emails.
I'm using UIActivityViewController to share in Facebook,email,twitter and texting. Everything works just fine with the exception of texting. When I select the texting option it doens't attach the image to the text. Here is my code:
NSMutableArray *tmp=[[NSMutableArray alloc]init];
[tmp addObject:tmpImage];
[tmp addObject:#"Hello"];
NSArray *activityItems =[NSArray arrayWithArray:tmp];
UIActivityViewController *activityVC=[[UIActivityViewController alloc]initWithActivityItems:activityItems applicationActivities:nil];
[self presentViewController:activityVC animated:YES completion:nil];
any of you knows why is not attaching the image to the texting part?
I'll really appreciate your help.
In app MMS (multi-media messaging) is not supported for the current iOS, only SMS is supported.
Possible solutions include:
•copying the image to the clipboard and having the user paste it into the messaging text box manually. (You can open a texting app that supports mms via the URI scheme "sms://" (just load that URL)
•loading the images into the eMail application and sending the eMail as a text message to either one of your servers that can sort out the issue, to the iMessages eMail address, or to the sms/mms eMail address (ex. a phone number of 404-345-6789 with AT&T could receive a text message if an eMail was sent to 4043456789#txt.att.net, all major carriers have an eMail address for every phone number).
My HoneyComb application runs on tablets and Google TV. I have setting to send email in my settings fragment, but it returns error of "No app can handle this function."
Is there a way to send email to browser through my application if there is no client (createChooser) available?
I also tried to display a summary of the customer service email, but summary is not working on HoneyComb. I was trying this so I could have disabled Intent on tv.
Is there a way to send email to browser through my application if there is no client (createChooser) available?
Not unless you know the specific email Web app and all of its details, and that email Web app supports some sort of direct-email-sending capability.
Either prompt the user to install an email app, or send the email yourself (e.g., JavaMail), or do not use email for communications on Google TV. I would expect few Google TV users to be using email on their televisions, so you need to plan accordingly.
Google TV includes a default, stub email app, so the system will appear to have an email app installed, even when there is none. There's a special check necessary to detect the stub:
Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.setType("plain/text"); // special mime legacy for gmail; others work
List<ResolveInfo> match = getPackageManager().queryIntentActivities(emailIntent, 0);
boolean hasEmailer = match.size() > 0;
Log.w("thuuz", "has plain/text Emailer: " + hasEmailer);
if (match.size() == 1) {
ResolveInfo info = match.get(0);
boolean real = true;
if (info.activityInfo.packageName.startsWith("com.google.android.tv.frameworkpackagestubs"))
real = false;
Log.w("thuuz", "has *real* Emailer: " + real);
}
In my application, if the user gave their gmail account then i am required to open the mail client with the gmail login credentials which comes when we select gmail option of mail programmatically but if that account is already stored in mail then i am required to redirect the user directly to their account. Can anybody pliz give me a glimpse of how i can achieve this programmatically.
You won't get that much control over the Mail app as all apps on the iPhone are sandboxed to prevent them from messing with Apple applications.
The only thing you can do (if you want to open the mail client to send an email), is something like this:
/* create mail subject */
NSString *subject = [NSString stringWithFormat:#"Subject"];
/* define email address */
NSString *mail = [NSString stringWithFormat:#"test#test.com"];
/* define allowed character set */
NSCharacterSet *set = [NSCharacterSet URLHostAllowedCharacterSet];
/* create the URL */
NSURL *url = [[NSURL alloc] initWithString:[NSString stringWithFormat:#"mailto:?to=%#&subject=%#",
[mail stringByAddingPercentEncodingWithAllowedCharacters:set],
[subject stringByAddingPercentEncodingWithAllowedCharacters:set]]];
/* load the URL */
[[UIApplication sharedApplication] openURL:url];
/* release the URL. If you are using ARC, remove this line. */
[url release];
Swift version of Léon Rodenburg's answer:
// define email address
let address = "test#test.com"
// create mail subject
let subject = "Subject"
// create the URL
let url = NSURL(string: "mailto:?to=\(address)&subject=\(subject)".stringByAddingPercentEncodingWithAllowedCharacters(NSCharacterSet.URLQueryAllowedCharacterSet())!)
// load the URL
UIApplication.sharedApplication().openURL(url!)
Swift:
if let url = NSURL(string: "mailto://\(email)") {
UIApplication.sharedApplication().openURL(url)
}
I would suggest a much more improved answer.
The Slack.com mobile app does this, it detects common email clients listed on the device and shows a popup picker of 'which' email client you would like to open.
So to implement:
Google around to find the top 10 email clients (eg Mail, Google Inbox, OutLook, AirMail etc).
Get a list of installed apps on the phone either by searching all apps (but I am told you can now only find if an app is explicitly installed, so you will need detect the app).
Show a popup list if more than 1 email app is detected, requesting them 'which' app to open eg. Mail, Inbox.
This is the best solution I have seen working to date.
How do you start the Mail app from a Titanium app?
I am looking for the equivalent of an HTML mailto: link where I can specify the email and maybe the subject from with in a windowView.
I am not using a webView.
Will
Try this one:
var emailDialog = Titanium.UI.createEmailDialog();
emailDialog.subject = "Sending email from Titanium";
emailDialog.toRecipients = ['name#gmail.com'];
emailDialog.messageBody = 'Appcelerator Titanium - Testing sending email';
emailDialog.open();
But remember that you cannot test this send email feature from iPhone Simulator (because iPhone simulator lacks of setting email account). Try to check in real phone.