Sending SMS with delivery message - c#

How can i write code for send SMS with delivery message in Windows Mobile? please guide me with C# or C++ code.
I want to use SmsSendMessage API in this code because this API have more features.

You could use SmsSendMessage to send the message and use SmsGetMessageStatus to get the status report of the sent SMS. This is all C++ code, but you can pinvoke it as well.

Microsoft.WindowsMobile.PocketOutlook Namespace
The Microsoft.WindowsMobile.PocketOutlook namespace provides classes that allow you to create and access PIM data items (Appointments, Tasks, and Contacts), and MAPI messaging items (e-mail and SMS messages), on mobile devices
SmsMessage Class in msdn
This sample shows how to send an SMS message to a mobile phone.
public void SmsMessageSend()
{
SmsMessage smsMessage = new SmsMessage();
//Set the message body and recipient.
smsMessage.Body = "Would you like to meet for lunch?";
smsMessage.To.Add(new Recipient("John Doe", "2065550199"));
smsMessage.RequestDeliveryReport = true;
//Send the SMS message.
smsMessage.Send();
return;
}

Related

How to use FCMClient to send messages to both Android and iPhone

Im using FCMClient in an MVC application to send alerts/messages to Android and iPhones.
I initialise https://github.com/tiagomtotti/firebaseNet/blob/master/src/FirebaseNet/Messaging/Message.cs and then send a message.....
var msg = new Message
{
To = token,
Data = someData
}
This sends alerts to an Android but not an iPhone. I looked at the documentation https://github.com/tiagomtotti/firebaseNet
and can see two classes AndroidNotifcation and IosNotification (https://github.com/tiagomtotti/firebaseNet/tree/master/src/FirebaseNet/Messaging)
I now noticed the Message class takes in an Interface for both notifications but how could setup the Message class to take in a notification but targets both Android and IoS?

How to send whatsApp message to any number by using twilio using c#

I am new to Twilio
below is my code to send whatsapp message using C#
static void Main(string[] args)
{
// Find your Account Sid and Token at twilio.com/console
TwilioClient.Init(Model.AccountSid, Model.AuthToken);
var message = MessageResource.Create(
//whatsapp message
to: new PhoneNumber(Model.To), from: new PhoneNumber(Model.From),
body: "Ahoy from Twilio!!!!!"
);
Console.WriteLine("Message SID: " + message.Sid);
}
Model.To have my whatsapp number which I have used while registering with twilio.
Model.From have Twilio's WhatsApp number
if I run this console application then I get message on my whatsapp number
but when I try to send message to my friend's WhatsApp number by assigning that number to Model.To,
I am not getting message on that number
How can I achieve it?
is there any other way to achieve it without twilio?
Thanks in advance.
Did you check the Twilio Debugger for errors. If you are sending the first message from Twilio out to the WhatsApp user, you must initially use a Template, as detailed here.
If you are using the Trial account then
1)first verify that number from here https://www.twilio.com/console/phone-numbers/verified
2)after verifying the number ,send whatsapp message from verified number to the twilio's whatsapp number using your sandbox code (code will be like e.g join XYZ-PQR)
3)after sending the whatsapp message that number will join your sandbox and you will be able to send message on that number

Change sender on reply using EWS Managed API

I'm currently trying to configure Mail2Bug to create Bugs in Azure DevOps when new emails arrive in a shared mailbox. Everything was going well until the part where it needs to reply to the incoming message.
The code which handles this function can be found in EWSIncomingMessage.cs:
public void Reply(string replyHtml, bool replyAll)
{
//_message is of type EmailMessage
var reply = _message.CreateReply(replyAll);
reply.BodyPrefix = new MessageBody(BodyType.HTML, replyHtml);
reply.Send();
}
Instead of replying using the shared mailbox's email, it uses the one from the authenticated user. I'm assuming this has to do with how CreateReply populates the reply MailMessage in combination with EWS.
Are there any ways around this (possibly by creating a new MailMessage and simulate a reply)?
You could refer to the below code:
var message = (EmailMessage) Item.Bind(service, new ItemId(uniqueId), PropertySet.FirstClassProperties);
var reply = message.CreateReply(false);
reply.BodyPrefix = "Response text goes here";
var replyMessage = reply.Save(WellKnownFolderName.Drafts);
replyMessage.Attachments.AddFileAttachment("d:\\inbox\\test.pdf");
replyMessage.Update(ConflictResolutionMode.AlwaysOverwrite);
replyMessage.SendAndSaveCopy();
For more information, please refer to these links:
Replying with attachments to an email message with EWS
How to reply to an email using the EWS Managed API?
Respond to email messages by using EWS in Exchange

How to Send SMS on Xamarin.Forms

I am developing Xamarin.Forms project, iOS, Android and Windows Phone.
My app ask the user to enter text Message and Phone number then on submit, I need to send SMS to the phone number.
I prefer to have a single implementation for all platforms.
You can use this open source plugin Xam.Plugins.Messaging
https://github.com/cjlotz/Xamarin.Plugins
This is the provided example (from https://github.com/cjlotz/Xamarin.Plugins/blob/master/Messaging/Details.md ) :
// Make Phone Call
var phoneDialer = CrossMessaging.Current.PhoneDialer;
if (phoneDialer.CanMakePhoneCall)
phoneDialer.MakePhoneCall("+272193343499");
// Send Sms
var smsMessenger = CrossMessaging.Current.SmsMessenger;
if (smsMessenger.CanSendSms)
smsMessenger.SendSms("+27213894839493", "Well hello there from Xam.Messaging.Plugin");
var emailMessenger = CrossMessaging.Current.EmailMessenger;
if (emailMessenger.CanSendEmail)
{
// Send simple e-mail to single receiver without attachments, bcc, cc etc.
emailMessenger.SendEmail("to.plugins#xamarin.com", "Xamarin Messaging Plugin", "Well hello there from Xam.Messaging.Plugin");
// Alternatively use EmailBuilder fluent interface to construct more complex e-mail with multiple recipients, bcc, attachments etc.
var email = new EmailMessageBuilder()
.To("to.plugins#xamarin.com")
.Cc("cc.plugins#xamarin.com")
.Bcc(new[] { "bcc1.plugins#xamarin.com", "bcc2.plugins#xamarin.com" })
.Subject("Xamarin Messaging Plugin")
.Body("Well hello there from Xam.Messaging.Plugin")
.Build();
emailMessenger.SendEmail(email);
}
Microsoft now has this feature in their new all-encompasing https://learn.microsoft.com/en-us/xamarin/essentials NuGet package.

Send sms Silently in WP8

I was trying to send sms to a group of contacts via SmsComposeTask class.
But this class's Show() method only composes message in message app. I also want my code to send those texts automatically. Please help!!
Here is what i am using:
SmsComposeTask smsComposeTask = new SmsComposeTask();
smsComposeTask.To = recipients; // recipients is the group of contacts
smsComposeTask.Body =
"Hello! This is a test sms message!";
smsComposeTask.Show();
See: http://social.msdn.microsoft.com/Forums/wpapps/en-us/85dc6ef5-98a9-4a17-a5f0-171372d8d9a3/how-to-send-sms-from-a-windows-phone-page
using Microsoft.Phone.Tasks;
SmsComposeTask smsComposeTask = new SmsComposeTask();
smsComposeTask.To = "2065550123"; smsComposeTask.Body = "Your SMS
text";
smsComposeTask.Show();
After that a dialog will be show asking the
user whether to send the message.
You cannot silently send an SMS
Also: https://developer.nokia.com/Community/Wiki/How_to_send_an_SMS_in_Windows_Phone
Note: In contrast to Symbian, Windows Phone does not allow you to send
sms "directly" or "silently" from your own app. As soon as sms sending
initiation code below is executed the native sms editor app will be
launched, giving the user the option to send the message or not.
I image this is done so that rouge apps can't send out a bunch of texts that will cost someone money.

Categories