我需要有一些想法(一些代码)来实现使用visual basic 2010开发的Windows应用程序在手机上发送短信。
我已完成电子邮件发送,但我不知道短信发送。
我已经使用PHP中的免费API发送短信。但是在vb.net中,我想在没有API的情况下这样做.. (我想将我的mobille连接到我的应用程序)
所以任何知识渊博的评论对我都有很大的帮助......谢谢。
答案 0 :(得分:1)
不确定我是否完全明白你的意思。但我想你只想在你的VB .Net应用程序中发送一条短信。例如,我想你的问题是如何从你的VB .Net应用程序发送短信到另一个电话号码。如果是这种情况,您应该像使用VB .Net发送电子邮件并使用SMS网关一样。 https://en.wikipedia.org/wiki/List_of_SMS_gateways
请记住,只能存在一个电话号码,因此发送短信至8005551212@vzwpix.com和8005551212@pm.sprint.com只会起作用。只收到一条消息,因为其他SMS网关没有号码。因此,请尝试创建所有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")
上查看完整的源代码