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.
Related
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.
I am developing a chat app in windows phone 8.1. I am using MQTT to communicate.It works fine when my app is in foreground.But I am facing two problems.
1) I am unable to get messages from sender when network is lost and reconnected.
2)I am unable to get messages from sender when I open the app which was sent in app inactive stage.
I am using this code to communicate:
client = new MqttClient("myhostname", 1883, false);
string id = Guid.NewGuid().ToString();
client.Connect(id);
The above cases works fine in android am I doing wrong ?? Please help me to solve.
Thanks,
Srinivas
I am trying to open out look from metro application (vs2012, windows store app).I used the following code:
var mailto = new Uri("mailto:?rbethamcharla#hotmail.com");
await Windows.System.Launcher.LaunchUriAsync(mailto);
But I am always getting access denied error.Could some one please let know how to enable this acess of outlook from windows 8 store app programmatically.
Thanks & Regards
Ravi Kumar B
First of all Need to check the url the code should be
var mailto = new Uri("mailto:rbethamcharla#hotmail.com");
await Windows.System.Launcher.LaunchUriAsync(mailto);
then it receives the email address. Secondly you can go through the link from msdn
access outlook MSDN
Some steps might be helpful. Try making outlook your by default mail client.
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.
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 :)