Sending email from ASP.NET(VB)

Discussion in 'General troubleshooting' started by mwmiller78, Feb 1, 2015.

  1. When I use the following code:

    Dim strFrom = "[email protected]"
    Dim strTo = "[email protected]"
    Dim MailMsg As New MailMessage(New MailAddress(strFrom.Trim()), New MailAddress(strTo))
    MailMsg.BodyEncoding = Encoding.Default
    MailMsg.Subject = "This is a test"
    MailMsg.Body = "This is a sample message using SMTP authentication"
    MailMsg.Priority = MailPriority.High
    MailMsg.IsBodyHtml = True
    Dim SmtpMail As New SmtpClient
    Dim basicAuthenticationInfo As New System.Net.NetworkCredential("[email protected]", "myPass")
    SmtpMail.Host = "mail.myDomain.com"
    SmtpMail.UseDefaultCredentials = False
    SmtpMail.Credentials = basicAuthenticationInfo
    SmtpMail.Send(MailMsg)

    the email sends fine. But if I change

    Dim strFrom = "[email protected]"
    to
    Dim strFrom = "[email protected]"

    it doesn't.

    Is there some setting on the email account itself that needs to be set in order to send an email?
     
  2. Also just noticed I'm getting a lot of Delivery Failure messages with links to "Report a blocked message"
    How do I set up my account to be able to send emails without this nonsense?
     
  3. Elshadriel

    Elshadriel Winhost Staff

    Are you using your actual domain name in your code?
     
  4. Really? :rolleyes:

    Anyway, I got it figured out I think. That stupid block message reply I mentioned earlier was being forwarded per a forward I set and deleted upon fwd so I never saw it. Once I filled out the form that link went to, it appears to have resolved itself.
     
    Elshadriel likes this.
  5. Elshadriel

    Elshadriel Winhost Staff

    Yes. Really. It's happened before, but I'm glad you were able to resolve the problem.
     

Share This Page