Results 1 to 2 of 2

Thread: Can not send email

  1. #1

    Thread Starter
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Can not send email

    I've got the below code which will send me an email of error details when dealing with customers. The problem is the email only seems to successfully send from certain ISP's. Could it be that even though the correct authenication details have been eneterd that certain ISP's are blocking port 25?

    vb Code:
    1. Dim SMTPUserInfo As NetworkCredential = New NetworkCredential("[email protected]", "MyPassword")
    2.             Dim insMail As New MailMessage(New MailAddress("[email protected]"), New MailAddress("[email protected]"))
    3.  
    4.             With insMail
    5.                 .Subject = "Error logs for customer " & customerID
    6.                 .Body = strBody.ToString
    7.             End With
    8.  
    9.             Dim smtp As New System.Net.Mail.SmtpClient
    10.             smtp.Host = "mail.OurWebsite.com" '
    11.             smtp.UseDefaultCredentials = False
    12.             smtp.Credentials = SMTPUserInfo
    13.             smtp.Port = 25
    14.             smtp.Send(insMail)

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: Can not send email

    Most ISPs won't relay messages for other domains. It's a measure against spammers and those who would send messages impersonating other parties. If you send a message from your own machine using your ISP's mail server then it will send fine. If someone else tries to send a message from another ISP using your ISP's mail server, it will most likely be rejected.

    You'll have to either use each individual user's own mail server to send the message or else use a mail server that will accept the message no matter what network the user is on.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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