Results 1 to 6 of 6

Thread: How to send Emails

Threaded View

  1. #6
    Addicted Member
    Join Date
    Sep 2009
    Location
    The Netherlands
    Posts
    148

    Re: How to send Emails

    Hi,
    A few days ago I've made the same thing.
    This is the code I've used:
    vb.net Code:
    1. Imports System.Net.Mail
    2. Public Class Form1
    3.  
    4. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    5. Dim MyMailMessage As New MailMessage()
    6. Try
    7. MyMailMessage.From = New MailAddress("@@@")
    8. MyMailMessage.To.Add("@@@")
    9. MyMailMessage.Subject = "@@@"
    10. MyMailMessage.Body = "Name" & vbTab & ": " & Name.Text & vbNewLine
    11.  
    12. Dim SMTP As New SmtpClient("@@") 'put in you providers SMTP server
    13. SMTP.EnableSsl = False
    14. SMTP.Credentials = New System.Net.NetworkCredential("@@@", "@@@") '1st @@@ emailaddess 2nd @@@ password
    15. SMTP.Send(MyMailMessage)
    16. MessageBox.Show("Mail send", MsgBoxStyle.Information, "Information")
    17. Catch ex As Exception
    18. End Try
    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.

    Again, if i'm wrong, love to hear it.

    Paul
    Last edited by Hakka; Sep 3rd, 2009 at 06:51 AM. Reason: typo

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width