SMS Problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • valar2k6
    New Member
    • Feb 2008
    • 1

    SMS Problem

    hi i have one doubt i send sms to phone via email but i got system.net.mail .smtpclient.sen d(mailmessage message) why this erro came. my code
    [code=vbnet]

    mTo = Trim(TextBox1.T ext) & Trim(ComboBox1. SelectedItem.To String())
    mFrom = Trim(TextBox2.T ext)
    mSubject = Trim(TextBox4.T ext)
    mMailServer = Trim(TextBox3.T ext)
    mMsg = Trim(TextBox5.T ext)

    Try
    Dim message As New MailMessage(mFr om, mTo, mSubject, mMsg)
    'Dim mySmtpClient As New SmtpClient(mMai lServer)
    'mySmtpClient.U seDefaultCreden tials = True
    'mySmtpClient.S end(message)

    Dim smtp As New SmtpClient()
    smtp.Host = "smtp.gmail.com "
    smtp.Credential s = New System.Net.Netw orkCredential
    smtp.EnableSsl = True

    smtp.Send(messa ge)
    'Dim basic Authentication Info As New System.Net.Netw orkCredential(m MailServer)



    MessageBox.Show (" The mail message has been sent to " & message.To.ToSt ring(), "Mail", MessageBoxButto ns.OK, MessageBoxIcon. Information)

    Catch ex As FormatException
    MessageBox.Show (ex.StackTrace, ex.Message, MessageBoxButto ns.OK, MessageBoxIcon. Error)
    Catch ex As SmtpException

    MessageBox.Show (ex.StackTrace, ex.Message, MessageBoxButto ns.OK, MessageBoxIcon. Error)
    Catch ex As Exception

    MessageBox.Show (ex.StackTrace, ex.Message, MessageBoxButto ns.OK, MessageBoxIcon. Error)
    End Try
    [/code]
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    You never said what error your are getting.

    As for gmail, did you make sure to turn on SMTP from your gmail account webpage?

    Comment

    Working...