locked
Send email RRS feed

  • Question

  • User1310055179 posted

    Hi,

    I am building a new website for my company. At the moment we are using static website and I would like to convert it all to ASP.NET.

    I have designed a nice bootstrap form, however I am having trouble with the contact us form.

    In my old website I userd asp and the following object:

    Set Mail = Server.CreateObject("Persits.MailSender")

    I tried implementing the following code:

    https://www.codeproject.com/Tips/371417/Send-Mail-Contact-Form-using-ASP-NET-and-Csharp

    However, I don't want to use a real 'from' email like this:

     var smtp = new System.Net.Mail.SmtpClient();
        {
            smtp.Host = "smtp.gmail.com";
            smtp.Port = 587;
            smtp.EnableSsl = true;
            smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
            smtp.Credentials = new NetworkCredential(fromAddress, fromPassword);
            smtp.Timeout = 20000;
        }

    I just want to use the mail address that the viewer filled in the form, just I like I do now:

    Mail.port = "25"
    Mail.From = Request("email") ' From address
    Mail.FromName = Request("first_name") & Request("last_name")' From Name

    Is there a way to use the asp Persits.MailSender object with .net? Or maybe is there another simple solution?

    Thanks

    Monday, February 26, 2018 10:05 AM

All replies