Buongiorno a tutti,
Ho ideato un programma per cucinare le ROM per Android, ed ho inserito la possibilità di potermi contattare tramite email con un apposito form, ed anche l'invio dei log di errore.
Un utente mi ha chiesto se fosse possibile settare un proxy per il mio programma. Per il download dei file, ho risolto, ma non riesco a farlo per l'invio delle email, ed anche dei report.
Quancuno può aiutarmi?
Per l'invio delle email, ovviamente, utilizzo System.Net.Mail
Il codice è il seguente
codice:
Public Sub send_email(ByVal mittente As String, ByVal oggetto As String, ByVal messaggio As String)
Try
Dim oMsg As New MailMessage()
oMsg.From = New MailAddress("mittente", "MorphDroid User")
oMsg.To.Add(New MailAddress("destinatario", "Assistenza"))
If oggetto = "" Then
oMsg.Subject = "Assistenza MorphDroid"
Else
oMsg.Subject = oggetto
End If
oMsg.Body = messaggio
oMsg.IsBodyHtml = True
Dim oSmtp As New SmtpClient(SMTP, PORTA)
oSmtp.DeliveryMethod = SmtpDeliveryMethod.Network
Dim oCredential As New Net.NetworkCredential("username", "password")
oSmtp.UseDefaultCredentials = False
oSmtp.Credentials = oCredential
oSmtp.EnableSsl = True
If proxy <> "" Then
ORA COME FACCIO AD IMPOSTARE IL PROXY?
End If
oSmtp.Send(oMsg)
MsgBox("Message sent successfully", MsgBoxStyle.Information, "Info")
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "Email error")
End Try
Me.Cursor = Cursors.Arrow
End Sub