1

I know this question has been asked several times, however, after digging through question for past hour an half and not finding any resolution i'm at a bit of a dead end. Also most of these questions refer to Window Server 2000 / Exchange 2003 / IIS 6.0

this is the code:

    var mail = new MailMessage();

    mail.From = new MailAddress("Administrator@$#@!.com");

    mail.To.Add(to);
    mail.Subject = subject;

    var plainView = AlternateView.CreateAlternateViewFromString(body, null, "text/plain");
    var htmlView = AlternateView.CreateAlternateViewFromString(body + "<img style=\"text-align: center;\" src=cid:companylogo><br/>", null, "text/html");
    ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; };

    var path = Server.MapPath(@"logo.jpg");
    var logo = new LinkedResource(path) {ContentId = "companylogo"};
    htmlView.LinkedResources.Add(logo);
    mail.AlternateViews.Add(plainView);
    mail.AlternateViews.Add(htmlView);

    var smtpClient = new SmtpClient();
    smtpClient.EnableSsl = true;
    System.Net.NetworkCredential("Administrator@$#@!.com", "!@#$%^");
    smtpClient.Send(mail);

I have tried authenticating in the web.config as well

  <smtp>
    <network host="192.000.0.001"
             userName="administrator@%^##.com"
             password="!@#$%^" port="25" />
  </smtp>

SBS 2008 Exchange 2007 IIS 7 SP2

I have tried different settings in the IIS SMTP Email settings and Exchange Send Connector.

I noticed some other posts had mentioned changing SMTP Virtual settings using IIS 6 manager however I am unable to view these settings in IIS 6. ex. Related Question

I know this is not a question that can be directly answered, however, any input in how I can go about effectively troubleshooting this issue.

Community
  • 1
  • 1
bumble_bee_tuna
  • 3,533
  • 7
  • 43
  • 83
  • 1
    I don't think the issue is at all related to your code. This is more likely a configuration issue on the Exchange Server. What's weird is that it complains that `administrator@dasdas.com` is not authorized to send an email as `administrator@dasdas.com`. I'd try using your own credentials for a second and see whether the email is sent or not. – Icarus Feb 27 '12 at 20:47
  • @Icarus Yeah that's also what is stumping that I can't even send within the domain, I haven't gotten to the hurdle of trying to send out of domain. I know this ultimately boils down to some issue with exchange and while I am somewhat knowledgeable on 2003, 2007 is a different beast. – bumble_bee_tuna Feb 27 '12 at 21:11

1 Answers1

1

I eventually found the answer to this was related to how the exchange server had been setup. SMTP did not work for any of the account however when I deleted the account and recreated it resolved the problem. I think it had something to do with a badly executed import.

bumble_bee_tuna
  • 3,533
  • 7
  • 43
  • 83