Public · Protected · Private
webmail
Type: Public  |  Created: 2012-08-24  |  Frozen: Yes
« Previous Public Blog Next Public Blog »
Comments
  • Razor syntax

    @{
        var customerName = Request["customerName"];
        var customerRequest = Request["customerRequest"];
        try {
            // Initialize WebMail helper WebMail.SmtpServer = "your SMTP host";
            WebMail.SmtpPort = 25;
            WebMail.EnableSsl = true;
            WebMail.UserName = "your user name here";
            WebMail.From = "your email address here";
            WebMail.Password = "your accound password";
            // Send email
            WebMail.Send(to: "target email address here"
                subject: "Help request from - " + customerName,
                body: customerRequest
            );
        }
        catch (Exception ex ) {
            <text>
              <b>The email was <em>not</em> sent.</b>
              The code in the ProcessRequest page must provide an
              SMTP server name, a user name, a password, and
              a "from" address. 
            </text>
        }
    }
    code picked from msdn help

    2012-08-24 23:23
This blog is frozen. No new comments or edits allowed.