2012-02-07 23 views
8

私はGmailのアカウントから無料のSMSをKarnatakaのAirtel MobileにC#Windowsアプリケーションを使用して送信しようとしています。メッセージが送信され、送信されたアイテムが表示されますが、携帯電話では受信されません。SMSゲートウェイ経由のメールが送信されましたが、受信されませんでした

これは私のコードで、

SmtpClient smtp = new SmtpClient(); 
smtp.Credentials = new NetworkCredential("[email protected]", "activedust");   
smtp.Port = 587; 
smtp.Host = "smtp.gmail.com"; 
smtp.EnableSsl = true; 
smtp.DeliveryMethod = SmtpDeliveryMethod.Network; 
MailMessage message = new MailMessage(); 

message.To.Add("[email protected]");//replace no with airtel mobile number in Karnataka 

message.From = new MailAddress("[email protected]", "App",System.Text.Encoding.UTF8); 
message.Body = "type your body"; 
message.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure; 
smtp.send(message); 

私はこのコードを使用して成功しemaill送るが、SMSのあなたが言及した携帯番号に、このサービスを有効にする必要があり

+0

は、それが実際にSMSゲートウェイへのSMS –

+1

メールの代わりに電子メール専用として受信されたかどうかを確認するために、どこかに電子メールを送信してみてください読みがで確実にメッセージを配信する悪名高い悪いです。あなたは非常によくキャリアによってブロックされているか、スパムとしてマークされている可能性があります。 –

+0

[smtp](https://fr.wikipedia.org/wiki/Wikipédia:Oracle/semaine_43_2013#Envoyer_un_SMS_par_e-mail)を使用するためのアカウントは必要ありません。セッションの例を見てください;あなたはフランス語を理解する必要はありませんそれのための")。 – user2284570

答えて

2

作業することはできません。それが有効にされていない場合は、携帯電話でSMSを受信することはありませんそれは49/- 料金やそのようなものが必要です。

あなたがチェックのSMSゲートウェイのリストについては、Gmailアカウント

using System.Net; 
using System.Net.Mail; 

public void SendTextMessage(string subject, string message, long telephoneNumer) 
     { 
      // login details for gmail acct. 
      const string sender = "[email protected]"; 
      const string password = "mypassword4gmailacct"; 

      // find the carriers sms gateway for the recipent. txt.att.net is for AT&T customers. 
      string carrierGateway = "txt.att.net"; 

      // this is the recipents number @ carrierGateway that gmail use to deliver message. 
      string recipent = string.Concat(new object[]{ 
      telephoneNumer, 
      '@', 
      carrierGateway 
      }); 

      // form the text message and send 
      using (MailMessage textMessage = new MailMessage(sender, recipent, subject, message)) 
      { 
       using (SmtpClient textMessageClient = new SmtpClient("smtp.gmail.com", 587)) 
       { 
        textMessageClient.UseDefaultCredentials = false; 
        textMessageClient.EnableSsl = true; 
        textMessageClient.Credentials = new NetworkCredential(sender, password); 
        textMessageClient.Send(textMessage); 
       } 
      } 
     } 

でテキストメッセージを送信することになり、再び

関連する問題