Is it possible to silently send an email from a Windows Phone 7 device?
The reason I ask is because I would like to have a system from which an app will send information to a server which the server will log. I figure if I use emails it would be a lot more straightforward than some other system.
As you can probably guess from my question I'm in completely unexplored territory here.
It's possible to send emails, so long as you are running the SMTP server on your server.
Web services are designed for this sort of thing, email isn't. You won't find emails simpler. Look into WCF.
Of course you can, sending email can be achieved with the EmailComposeTask.
To use the EmailComposeTask , you must include the namespace Microsoft.Phone.Tasks .
*`Using Microsoft.Phone.Tasks ;`*
This namespace can be found in the Microsoft.Phone.dll
To send the email , create an instance of the EmailComposeTask and set the appropriate properties like
To , Subject and Body of the Email .
private void button1_Click(object sender, RoutedEventArgs e)
{
EmailComposeTask emailcomposer = new EmailComposeTask();
emailcomposer.To = "test#ginktage.com";
emailcomposer.Subject = "subject from test app";
emailcomposer.Body = "This is a test mail from Email Composer";
emailcomposer.Show();
}
When the Show method is called , the EmailComposer is opened which lets the user to click the send button to send the email
I hope it's clear :)
Related
In Xamarin Forms I have added a gesture recognizer to let a user click on an email address label and have it open an email application.
On Android this works, the user is asked of they want to open in gmail or an email application, but nothing happens on ios.
Is there something ios-specific I have to do to handle this?
var emailGestureRecognizer = new TapGestureRecognizer();
emailGestureRecognizer.Tapped += (s, e) =>
{
Device.OpenUri(new Uri("mailto:" + venue.ContactEmail));
};
ContactLabel.GestureRecognizers.Add(emailGestureRecognizer);
Based on the Apple documentation, this is correct.
iOS Note: If the Mail app is not installed, clicking a mailto URL displays an appropriate warning message to the user.
Since the Mail (and Phone and possibly others) app is not installed on the Simulator, these links will not work.
I am trying to use c# Microsoft Outlook Interop to send an email with voting options. The only issue is that I want to not receive the response but rather the responses be sent to another email address (not mine).
Currently my code sends the voting responses to myself which is not what i want. I want to send it to a given email that I provide in string format.
This is my existing code:
Microsoft.Office.Interop.Outlook.Application app = new Microsoft.Office.Interop.Outlook.Application();
Microsoft.Office.Interop.Outlook.MailItem mail = app.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);
mail.Body= "hi";
mail.VotingOptions = "Cheese;Combo;Maybe;";
mail.Recipients.Add("abc#gmail.com");
mail.Send();
Use MailItem.ReplyRecipients.Add.
I read all the other questions regarding this topic but none actually answers exactly my question.
I installed twilio package. added it to the C# project.
opened an account in twilio and had a number and so on.
but it seems not working
any ideas ? here's the code
using System;
using Twilio;
namespace Project_C_Sharp_Final
{
public partial class User : Form
{
private void label4_Click(object sender, EventArgs e)
{
string AccountSid = "[i wrote the sid here]";
string AuthToken = "[i wrote the authtoken here]";
var twilio = new TwilioRestClient(AccountSid, AuthToken);
var message = twilio.SendMessage("YOUR_TWILIO_NUMBER", "THE NUMBE I WANT TO SEND TO" , "Check New Offers");
}
}
}
message is not being sent...
did i write anything wrong ? did i miss anything ?
Before putting my solution, I want to re-iterate what philnash has mentioned. Testing Twilio Credentials will not actually send SMS.
If you are using test credendials then below solution will not work for you.
For error : Permission Not Enable for the region indicated by the to number, that means the country you are trying to send SMS to is not enabled in geolocation settigs of your Twilio account.
You need to loging to twilio portal and navigate to following URL.
https://www.twilio.com/user/account/settings/international
Here you can enable/disable countries for both SMS and Voice Call. Check if the country you are trying to send SMS to is enabled in that page or not. If not you can enable it and try sending SMS again.
Thanks and regards,
Chetan Ranpariya
Twilio developer evangelist here.
In the comments you say you're using the test credentials. Test credentials will not actually send any messages (or make calls) they are to make sure you're making the request correctly without costing you.
To make Twilio send messages you need to use the production credentials. If you are still on a trial account this won't cost you anything either.
When ever I used this below piece of code, it launches the messaging app, i don't want that. I want to send SMS within my app. How to do that. any ideas ?
Code
SmsComposeTask smsComposeTask = new SmsComposeTask();
smsComposeTask.To = "9012345566778"; // Mention here the phone number to whom the sms is to be sent
smsComposeTask.Body = "Hello! How are you"; // the string containing the sms body
smsComposeTask.Show(); // this will invoke the native sms edtior
You can't send a SMS directly from your app. Using the SmsComposeTask (and therefore displaying the message hub) is the only way.
I think KooKiz is right. windows phone is cared for its security.
I am developing a Windows Store Application (Windows 8).
I have a need to send emails based on data and address stored in the application data and without the need of the user to type it the data or the address.
What would be the right/easy way to implement it?
EitanB
You can try with
var mailto = new Uri("mailto:?to=recipient#example.com&subject=The subject of an email&body=Hello from a Windows 8 Metro app.");
await Windows.System.Launcher.LaunchUriAsync(mailto);
The correct way would be to use Sharing. Your app should create an HTML document or Text and share it. The user would select Mail from the Share charm and the HTML/Text would become the body of the email.
See here for more info...
http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh973055.aspx
This is the correct syntax to use for a mailto: link (unlike the other examples above with a mailto: which are incorrect..)
var mailto = new Uri("mailto:yourname#email.com?subject=" + subject + "&body=" + body);
await Launcher.LaunchUriAsync(mailto);
The problem with the mailto: method is if the user has no client program associated with mailto: nothing will happen.
The most reliable method to use is a web service or WCF service of some sort. Using the Share Charm while considered the 'correct' way on Windows 8, is not neccessarily the best as the user may still have no email client installed, for example if they rely on gmail.com for their email.
If you are developping a Universal WinRT Windows Phone application, you could use the "Windows.ApplicationModel.Email.EmailMessage" namespace as the "Microsoft.Phone.Tasks.EmailComposeTask" namespace doesn't work on WinRT application.
Then, uses this code to create and launch a new email.
// Create your new email message.
var em = new EmailMessage() ;
// Add as much EmailRecipient in it as you need using the following method.
em.To.Add(new EmailRecipient("yourname#yourdomain.com"));
em.Subject = "Your Subject...";
em.Body = "Your email body...";
// You can add an attachment that way.
//em.Attachments.Add(new EmailAttachment(...);
// Show the email composer.
await EmailManager.ShowComposeNewEmailAsync(em);
I hope it will solve your (or other developers) problem.
Regards.
It's always possible to connect to an SMTP server and issue commands like HELO, MAIL, RCPT, etc. Of course you'll need an SMTP server to connect to. I use this on our corporate intranet to send emails.