Trouble sending email with ASP .NET

Discussion in 'Email' started by Austin, Jul 30, 2014.

  1. I am new to both ASP .NET and using program to Email a user, so sorry if this is a simple answer.

    Right now this keeps failing (can't get the except) after I try to send the mail. I am guessing at what goes where, and I cannot figure it out from the tutorials and examples.

    I have logged into the smartermail thing and I see the postmaster account as well.

    Other than that, I have no idea what I am doing in terms of entering the correct information for the mailserver. :/
    Any help appreciated!
    -Austin

    MailMessage mail = new MailMessage();
    mail.To.Add(email);
    mail.From = new MailAddress("postmaster@mydomain.com");
    mail.Subject = "Error:" + name + " " + category;
    mail.Body = details;
    mail.IsBodyHtml = false;

    SmtpClient SmtpServer = new SmtpClient("mail.mydomain.com");
    SmtpServer.Host = "mail.mydomain.com";
    SmtpServer.Credentials = new System.Net.NetworkCredential("postmaster@mydomain.com", "mysitepassword");
    SmtpServer.EnableSsl = false;

    SmtpServer.Send(mail);
     
  2. Ray

    Ray

    What's the error message you are getting? Most of the time, the common mistakes are inputting the wrong SMTP server name, or the wrong email address with it's corresponding password. In your example code you have 'mysitepassword'. I'm sure that's not the password to your postmaster account, and I'm sure when you type @mydomain.com you are really typing your domain name of the account. So check the password. It does not have to necessarily match that of your control panel password.
     

Share This Page