1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| Private Sub btnSend_Click(sender As Object, e As EventArgs) Handles btnSend.Click
'Adresse Webmail http://webmail.hostinger.fr
'Login Username Adresse E-mail Utilisateur
'Mot de passe Mot de passe Utilisateur E-mail
'POP3/IMAP Host mx1.hostinger.fr
'POP3 Port 110
'IMAP Port 143
'SMTP Host mx1.hostinger.fr
'SMTP Port 2525
'Manage E-mail Accounts Manage E-mails
If txtSendTo.Text = "" Then
MsgBox("L'adresse mail de l'expéditeur est vide.", MsgBoxStyle.Exclamation, "Envoyer les informations d'activation")
Exit Sub
End If
If IsWebConnected() = False Then
MsgBox("Impossible d'envoyer un email, pas de connexion internet detectée.", MsgBoxStyle.Exclamation, "Envoyer les informations d'activation")
Exit Sub
End If
Dim smtp As New SmtpClient
smtp.Host = "mx1.hostinger.fr"
smtp.Port = 2525
smtp.Credentials = New Net.NetworkCredential(login, password)
smtp.EnableSsl = False
Dim mail As New MailMessage
mail.Subject = txtSubject.Text
mail.Body = txtBody.Text
mail.To.Add(New MailAddress(txtSendTo.Text))
mail.From = New MailAddress(txtSendFrom.Text)
mail.BodyEncoding = System.Text.Encoding.GetEncoding("iso-8859-1")
mail.SubjectEncoding = System.Text.Encoding.GetEncoding("iso-8859-1")
Try
smtp.Send(mail)
MsgBox("The email has been sent.", MsgBoxStyle.Information, "Envoyer les informations d'activation")
Catch ex As SmtpException
MsgBox(ex.Message)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub |