protected void btnSend_Click(object sender, EventArgs e) { // Because the SendMail method can through an exception, // we should place it in a try/catch block try { // Create our clsBusinessLayer object that will // send the message for us clsBusinessLayer sendObj = new clsBusinessLayer(); // Send the email using data from the form sendObj.SendEmail(txtFrom.Text, txtTo.Text, txtSubject.Text, txtMessage.Text); // Successful send - tell user lblSts.Text = "Status: The message was sent successfully to: " + txtFrom.Text; } catch (Exception ex) { // Error when sending - tell user lblSts.Text = "Status: An error has happened sending the email, " + ex.Message; } return; } // end btnSend_Click
protected void btnSend_Click(object sender, EventArgs e) { // Because the SendMail method can through an exception, // we should place it in a try/catch block try { // Create our clsBusinessLayer object that will // send the message for us clsBusinessLayer sendObj = new clsBusinessLayer(); // Send the email using data from the form sendObj.SendEmail(txtFrom.Text, txtTo.Text, txtSubject.Text, txtMessage.Text); // Successful send - tell user lblSts.Text = "Status: The message was sent successfully to: " + txtFrom.Text; } catch (Exception ex) { // Error when sending - tell user lblSts.Text = "Status: An error has happened sending the email, " + ex.Message; } return; }
protected void btnSendMail_Click(object sender, EventArgs e) { Master.UserFeedBack.Text = myBusinessLayer.SendEmail(txtFrom.Text, txtTo.Text, txtSubject.Text, txtMessage.Text, txtPassword.Text); }