2011-09-13 8 views
4

私はWebアプリケーションからインドのモバイルにSMSを送信する必要があります。WebアプリケーションからSMSをインドのモバイルに送信するためのJavaコード

私はipipi.com websiteからのコードの下になった:私はこの機能を実装したい

、誰も私を助けてください可能性があり、ここで提供されるべきであるかの値:

String username = "YoureIPIPIUsername"; 
String password = "YourPassword"; 
String smtphost = "ipipi.com"; 
String compression = "Compression Option goes here - find out more"; 
String from = "[email protected]"; 
String to = "[email protected]"; 
String body = "Your Message"; 

SMTPSend.class

import java.io.*; 
import java.net.InetAddress; 
import java.util.Properties; 
import java.util.Date; 
import javax.mail.*; 
import javax.mail.internet.*; 
import javax.activation.*; 

public class SMTPSend { 

    public SMTPSend() { 
    } 

    public void msgsend() { 
     String username = "YoureIPIPIUsername"; 
     String password = "YourPassword"; 
     String smtphost = "ipipi.com"; 
     String compression = "Compression Option goes here - find out more"; 
     String from = "[email protected]"; 
     String to = "[email protected]"; 
     String body = "Your Message"; 
     Transport tr = null; 

     try { 
     Properties props = System.getProperties(); 
     props.put("mail.smtp.auth", "true"); 

     // Get a Session object 
     Session mailSession = Session.getDefaultInstance(props, null); 

     // construct the message 
     Message msg = new MimeMessage(mailSession); 

     //Set message attributes 
     msg.setFrom(new InternetAddress(from)); 
     InternetAddress[] address = {new InternetAddress(to)}; 
     msg.setRecipients(Message.RecipientType.TO, address); 
     msg.setSubject(compression); 
     msg.setText(body); 
     msg.setSentDate(new Date()); 

     tr = mailSession.getTransport("smtp"); 
     tr.connect(smtphost, username, password); 
     msg.saveChanges(); 
     tr.sendMessage(msg, msg.getAllRecipients()); 
     tr.close(); 
     } catch (Exception e) { 
      e.printStackTrace(); 
     } 
    } 

     public static void main(String[] argv) { 
      SMTPSend smtpSend = new SMTPSend(); 
      smtpSend.msgsend(); 
     } 
} 
+3

アカウントを設定してクレジットを購入したと思われますか? - もしあれば、正確な問題は何ですか? –

+0

@キラン..あなたはそれを働かせましたか?あなたはインドの携帯電話番号にSMSを送ることができますか? 私は同じようなfe feを探しています – maaz

+0

http://www.nataraz。あなたの携帯からスマートなJavaプログラムへの/ SMSの送信/# – Android

答えて

1

上記のコードが着信電子メールメッセージを発信SMSメッセージに変換するサービスにリンクしている場合は、おそらく前述のbのクレジットを購入する必要がありますy Alex K.

SMSを送信するより良い方法は、携帯電話プロバイダーのSMSCとのインターフェイスにSMSLibを使用することです。また、プロバイダがSMSをすべてのセルラーネットワークにルーティングできることを確認する必要があります。

0

最初にipipi.comにアカウントを作成し、mail.Andに送信されたアクティベーションリンクをクリックして、YoureIPIPIUsernameとYourPasswordとしてのパスワードを入力して検証します。

String smtphost = "ipipi.com" 

String compression = "Compression Option goes here - find out more"; 

uはあなたが「なし」

String from = "[email protected]" 
String to = "[email protected]"; 

先のpH数は91と10桁の番号

String body = "Your Message"; 
あるべき挙げることができる何かをしたくない場合は、いくつかの圧縮タイプ hereがあります。
1

あなたの質問は、サービスプロバイダ/ APIに固有のようです。しかしここでは一般的な回答をしたいと思います。

SMSを送信するには、SMSCへのSMSゲートウェイが必要です。もっと簡単な方法が2つあります。 SIMカード[SMS有効]を使用することも、他の人のSIMカードを使用することもできます。 SIMカードは、SMSCを使用してサービスプロバイダを通じてSMSゲートウェイに接続します。

どちらの方法でも、SMSは無料ではありません。他の人には、無料ですが、少なくとも広告や長期的なビジネスマーケティング戦略が必要です。

あなたが提供しているAPIを使って、他の人のSIMを使用しています。これらは一括のSMSアカウントを持っているので、より速く、複数スレッドのサービスかもしれません。商業的にあなたの問題を分類するのに役立つはずです。

SIMからSMSを送信する場合は、SIMをコンピュータに接続し、標準APIを使用してSMS機能を呼び出す必要があります。 SMSLibが私の提案です。 SIMをPCに接続するためのハードウェアが必要です。携帯電話に接続するか、データモデム[easy]を使用し、COMポート経由で接続します。

独自のSMSゲートウェイを試したい場合は、このコードhereを試してみてください。

関連する問題