Hi,
A few days ago I've made the same thing.
This is the code I've used:
Although (as far as I know) it depends on your providers SMTP and if they allow to send mails at port 25. My provider only let me send SMTP mail through their smtp address. So if you want to be able to send from different places be sure to adjust the SMTP address.vb.net Code:
Imports System.Net.Mail Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim MyMailMessage As New MailMessage() Try MyMailMessage.From = New MailAddress("@@@") MyMailMessage.To.Add("@@@") MyMailMessage.Subject = "@@@" MyMailMessage.Body = "Name" & vbTab & ": " & Name.Text & vbNewLine Dim SMTP As New SmtpClient("@@") 'put in you providers SMTP server SMTP.EnableSsl = False SMTP.Credentials = New System.Net.NetworkCredential("@@@", "@@@") '1st @@@ emailaddess 2nd @@@ password SMTP.Send(MyMailMessage) MessageBox.Show("Mail send", MsgBoxStyle.Information, "Information") Catch ex As Exception End Try
Again, if i'm wrong, love to hear it.
Paul




Reply With Quote
