简体   繁体   English

如何在VB.Net中实现短信发送?

[英]how to implement SMS sending in VB.Net?

I need to have some idea (some code) to implement sms sending on mobile phones using windows application developed in visual basic 2010. 我需要一些想法(一些代码)来实现使用Visual Basic 2010中开发的Windows应用程序在手机上发送短信。
I have done with email sending, but i have no idea about sms sending. 我已经完成了电子邮件发送,但是我不知道发送短信。

I have done sms sending using free API's in PHP. 我已经使用PHP中的免费API发送了短信。 But in vb.net I want to do it without APIs.. (I want to connect my mobille to my application) 但是在vb.net中,我想在没有API的情况下进行操作。 (我想将mobille连接到我的应用程序)

So any knowledgeable comment will be big help for me...Thanks. 因此,任何有见识的评论对我都将有很大帮助...谢谢。

Not sure if I fully understand what your saying. 不知道我是否完全理解你的意思。 But I think you simply want to send an SMS message in your VB .Net application. 但是我认为您只是想在VB .Net应用程序中发送一条SMS消息。 For example I think what your asking is how to send an SMS message from your VB .Net application to another phone number. 例如,我认为您要问的是如何从VB .Net应用程序向另一个电话号码发送SMS消息。 If that is the case you should do the same as you would when sending E-Mails with VB .Net and utilize the SMS gateways. 如果是这种情况,您应该执行与使用VB .Net发送电子邮件并使用SMS网关时相同的操作。 https://en.wikipedia.org/wiki/List_of_SMS_gateways https://zh.wikipedia.org/wiki/List_of_SMS_gateways

Remember only one phone number can exist so sending an sms message to 8005551212@vzwpix.com and 8005551212@pm.sprint.com will only will work. 请记住,只有一个电话号码可以存在,因此只能将短信发送到8005551212@vzwpix.com和8005551212@pm.sprint.com。 Only one message will be recieved because the other SMS gateways don't have a number for it. 仅收到一条消息,因为其他SMS网关没有编号。 So try creating a list of all the SMS gateways and having the the user type their number in and then sending the message out with the users entered number@gateway.com will work. 因此,尝试创建所有SMS网关的列表,并让用户键入其号码,然后在用户输入number@gateway.com的情况下发送消息。

    'Now lets test the E-Mail functionality on our phone gap site. This section does just that.
    Dim email As New MailMessage
    Dim mailfrom As String
    Dim mailto As String

    mailfrom = lblAddress.Text
    mailto = tbNumber.Text

    email.To.Add(mailto)
    email.From = New MailAddress(mailfrom)
    email.Body = tbmsgBody.Text

    Dim sendserver As String

    sendserver = lblSMTP.Text
    Dim SMTP As New SmtpClient(sendserver)
    Dim username As String
    Dim password As String

    username = lblUName.Text
    password = lblPW.Text

    If lblSSL.Text = "Yes" Then
        SMTP.EnableSsl = True
    Else : SMTP.EnableSsl = False
    End If

    SMTP.Credentials = New System.Net.NetworkCredential(username, password)
    Dim portnum As String

    portnum = lblPort.Text
    SMTP.Port = portnum
    SMTP.Send(email)
    MessageBox.Show("Message Sent")
ElseIf cbAction.Visible = True And cbAction.Text = "Send" And tbSubject.Visible = False Then
    'The idea behind this section is mainly to use the SMS Gateways and using the same E-Mail Form. Since their will only always be just one phone. We can try to send the same message to all of of the SMS gateways for that number. Obviously only one message will ever be recieved and the sender of the message will get a whole bunch of delivery failure messages. But at least one will get to the actual phone number.
    Dim email As New MailMessage
    Dim mailfrom As String
    Dim mailto As String

    mailfrom = lblAddress.Text
    mailto = tbNumber.Text
    'Now lets add our SMS Gateways
    'Since this is a SMS and MMS portion their will be no need to add a subject feild.
    email.Bcc.Add(mailto + "@myboostmobile.com")
    email.Bcc.Add(mailto + "@vtext.com")
    email.Bcc.Add(mailto + "@sms.airfiremobile.com")
    email.Bcc.Add(mailto + "@msg.acsalaska.com")
    email.Bcc.Add(mailto + "@sms.alltelwireless.com")
    email.Bcc.Add(mailto + "@mms.alltelwireless.com")
    email.Bcc.Add(mailto + "@message.Alltel.com")
    email.Bcc.Add(mailto + "@text.wireless.alltel.com")
    email.Bcc.Add(mailto + "@mms.alltel.net")
    email.Bcc.Add(mailto + "@paging.acswireless.com")
    email.Bcc.Add(mailto + "@txt.att.net")
    email.Bcc.Add(mailto + "@mmode.com")
    email.Bcc.Add(mailto + "@mms.att.net")
    email.Bcc.Add(mailto + "@txt.att.net")
    email.Bcc.Add(mailto + "@cingularme.com")
    email.Bcc.Add(mailto + "@mobile.mycingular.com")
    email.Bcc.Add(mailto + "@page.att.net")
    email.Bcc.Add(mailto + "@sms.smartmessagingsuite.com")
    email.Bcc.Add(mailto + "@bellsouth.cl")
    email.Bcc.Add(mailto + "@sms.bluecell.com")
    email.Bcc.Add(mailto + "@mms.myblueworks.com")
    email.Bcc.Add(mailto + "@cellcom.quiktxt.com")
    email.Bcc.Add(mailto + "@csouth1.com")
    email.Bcc.Add(mailto + "@cwemail.com")
    email.Bcc.Add(mailto + "@sms.cvalley.net")
    email.Bcc.Add(mailto + "@cingular.com")
    email.Bcc.Add(mailto + "@cingular.com")
    email.Bcc.Add(mailto + "@mobile.mycingular.com")
    email.Bcc.Add(mailto + "@cingulartext.com")
    email.Bcc.Add(mailto + "@sms.cleartalk.us")
    email.Bcc.Add(mailto + "@sms.mycricket.com")
    email.Bcc.Add(mailto + "@mms.mycricket.com")
    email.Bcc.Add(mailto + "@cspire1.com")
    email.Bcc.Add(mailto + "@sms.edgewireless.com")
    email.Bcc.Add(mailto + "@SMS.elementmobile.net")
    email.Bcc.Add(mailto + "@mobile.gci.net")
    email.Bcc.Add(mailto + "@gscsms.com")
    email.Bcc.Add(mailto + "@hawaii.sprintpcs.com")
    email.Bcc.Add(mailto + "@myhelio.com")
    email.Bcc.Add(mailto + "@iwirelesshometext.com")
    email.Bcc.Add(mailto + "@mobile.kajeet.net")
    email.Bcc.Add(mailto + "@text.longlines.com")
    email.Bcc.Add(mailto + "@mymetropcs.com")
    email.Bcc.Add(mailto + "@messaging.sprintpcs.com")
    email.Bcc.Add(mailto + "@pm.sprint.com")
    email.Bcc.Add(mailto + "@messaging.nextel.com")
    email.Bcc.Add(mailto + "@page.nextel.com")
    email.Bcc.Add(mailto + "@tmomail.net")
    email.From = New MailAddress(mailfrom)
    email.Subject = tbSubject.Text
    email.Body = tbmsgBody.Text

    Dim sendserver As String

    sendserver = lblSMTP.Text
    Dim SMTP As New SmtpClient(sendserver)
    Dim username As String
    Dim password As String

    username = lblUName.Text
    password = lblPW.Text

    If lblSSL.Text = "Yes" Then
        SMTP.EnableSsl = True
    Else : SMTP.EnableSsl = False
    End If

    SMTP.Credentials = New System.Net.NetworkCredential(username, password)
    Dim portnum As String

    portnum = lblPort.Text
    SMTP.Port = portnum
    SMTP.Send(email)
    MessageBox.Show("Message Sent")

You can view entire source code on https://github.com/LinuxPhreak/PhoneGap-Emulators 您可以在https://github.com/LinuxPhreak/PhoneGap-Emulators上查看完整的源代码

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM