Creating AN ASP Contact Page Email Won't Send

Discussion in 'ASP.NET / ASP.NET Core' started by cpringle, Oct 21, 2012.

  1. Hi

    Can anybody help me, I am currently an discountASP user and I am attempting to create a contact page, I have tried so many different varations of my code to no avail, can you help. I can send email from contactform to sales using outlook no problem but won't work on the web server.

    MailMessage mail = new MailMessage();

    //set the addresses
    mail.From = new MailAddress("[email protected]");
    mail.To.Add("[email protected]");

    string subject = YourSubject.Text.ToString();
    string body = "From: " + YourName.Text + "\n";
    body += "Email: " + YourEmail.Text + "\n";
    body += "Subject: " + YourSubject.Text + "\n";
    body += "Question: \n" + Comments.Text + "\n";
    //set the content
    mail.Subject = subject;
    mail.Body = body;
    //send the message
    SmtpClient smtp = new SmtpClient("smtp.financialsubsystem.co.uk");

    NetworkCredential Credentials = new NetworkCredential("[email protected]", "@@@@");
    smtp.Credentials = Credentials;
    smtp.Send(mail);

    Regards
    Colin
     
  2. bgoodbody

    bgoodbody Bill G

    Hmm, we set up the server in web.config, but manually should work.

    Is there an error when you send?

    No FROM address?

    Do you get a reject from your server? from DASP?

    http://systemnetmail.com/
     

Share This Page