Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6665395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:43:08+00:00 2026-05-26T02:43:08+00:00

I need to change the response to a mailer which is gets its instruction

  • 0

I need to change the response to a mailer which is gets its instruction form a drop down selection box on the webpage.

The original code is working and appears fairly simple, but it emails the wrong department heads, because it isn’t specific enough.

I’m not a coder, but I thought to have a stab at this.

This is the original code:

       public partial class ContactUs : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {

        Calendar cal = new Calendar();
        string dat = cal.TodaysDate.Date.ToLongDateString();

            System.Web.Mail.MailMessage mm = new MailMessage();
            mm.From = "WBS Website<info@wbs.ae>";
            if (DrpDwnType.SelectedItem.Value == "G")
                mm.To = "david@wbs.ae";
            else
                mm.To = "robert@wbs.ae";

            mm.Cc = "wolfi@wbs.ae";
            mm.Bcc = "precise.customer@gmail.com";
            mm.Subject = "Online comments from WBS website visitor, " + TXTFname.Text;
            mm.Body = "<div style='border:solid 2px RED; padding:25px 25px 25px 25px'><br><br> <strong>Online comments from WBS website</strong><br> <br> ------------------------------------- <br> Date : " + dat + "<br> <br> First Name : " + TXTFname.Text + "<br>Last Name : " + TXTLastName.Text + "<br> Email Address : " + TXTEmail.Text + "<br> Contact No : " + TXTMob.Text + "<br> Enquiry Type : " + DrpDwnType.SelectedItem.Text + "<br> <br> <br> The visitor comment : <br> --------------------------------------- <br> " + TXTComment.Text + "</strong><br><br>Further Information : " + RadioButtonList1.SelectedItem.Value.ToString() + "<br><br><br></div>";
            mm.BodyFormat = MailFormat.Html;
            SmtpMail.Send(mm);
            TXTFname.Text = "";
            TXTLastName.Text = "";
            TXTMob.Text = "";
            TXTComment.Text = "";
            TXTEmail.Text = "";
            TXTMess.Text = "Thank you for your interest in WBS!!! ";



    }
}

This is what I’ve come up with through my research:

   public partial class ContactUs : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {

        Calendar cal = new Calendar();
        string dat = cal.TodaysDate.Date.ToLongDateString();

            System.Web.Mail.MailMessage mm = new MailMessage();
            mm.From = "WBS Website<info@wbs.ae>";

    if (DrpDwnType.SelectedItem.Value == "S")
        {
                mm.To = "gavin@wbs.ae";
        }
    else if (DrpDwnType.SelectedItem.Value == "R")
        {
                mm.To = "king@wbs.ae";
        }
    else
        {
                mm.To = "josh@wbs.ae";
        }       

            mm.Cc = "robert@wbs.ae;josh@wbs.ae";
            mm.Bcc = "wolfi@wbs.ae";
            mm.Subject = "Online comments from WBS website visitor, " + TXTFname.Text;
            mm.Body = "<div style='border:solid 2px RED; padding:25px 25px 25px 25px'><br><br> <strong>Online comments from WBS website</strong><br> <br> ------------------------------------- <br> Date : " + dat + "<br> <br> First Name : " + TXTFname.Text + "<br>Last Name : " + TXTLastName.Text + "<br> Email Address : " + TXTEmail.Text + "<br> Contact No : " + TXTMob.Text + "<br> Enquiry Type : " + DrpDwnType.SelectedItem.Text + "<br> <br> <br> The visitor comment : <br> --------------------------------------- <br> " + TXTComment.Text + "</strong><br><br>Further Information : " + RadioButtonList1.SelectedItem.Value.ToString() + "<br><br><br></div>";
            mm.BodyFormat = MailFormat.Html;
            SmtpMail.Send(mm);
            TXTFname.Text = "";
            TXTLastName.Text = "";
            TXTMob.Text = "";
            TXTComment.Text = "";
            TXTEmail.Text = "";
            TXTMess.Text = "Thank you for your interest in WBS!!! ";


    }
}

At this point, this is a mental exercise for me. I may or not attempt to recompile the website without professional help.

** Edit: **
I’m looking to find out if the code I’ve modified in the second portion will work, and if there is a better way to go about choosing the department that gets mailed based on the selection in the drop down list.

2nd Edit:

Current:

<asp:DropDownList
     ID="DrpDwnType" runat="server" Width="260px" Font-Bold="True">
     <asp:ListItem Value="0">-- select --</asp:ListItem>
     <asp:ListItem Value="G">General                  </asp:ListItem>
     <asp:ListItem Value="S">Service or Workshop</asp:ListItem>
     <asp:ListItem Value="R">Rental Bike</asp:ListItem>
     <asp:ListItem Value="C">Cycling in Dubai</asp:ListItem>
</asp:DropDownList>

New:

<asp:DropDownList
     ID="DrpDwnType" runat="server" Width="260px" Font-Bold="True">
     <asp:ListItem Value="0">-- select --</asp:ListItem>
     <asp:ListItem Value="josh@wbs.ae">General</asp:ListItem>
     <asp:ListItem Value="gavin@wbs.ae">Service or Workshop</asp:ListItem>
     <asp:ListItem Value="king@wbs.ae">Rental Bike</asp:ListItem>
     <asp:ListItem Value="josh@wbs.ae">Cycling in Dubai</asp:ListItem>
</asp:DropDownList>

Then set the mailer to something like:

public partial class ContactUs : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void Button1_Click(object sender, EventArgs e)
        {

            Calendar cal = new Calendar();
            string dat = cal.TodaysDate.Date.ToLongDateString();

                System.Web.Mail.MailMessage mm = new MailMessage();
                mm.From = "WBS Website<info@wbs.ae>";
                mm.To = DrpDwnType.SelectedValue;
                mm.Cc = "robert@wbs.ae;josh@wbs.ae";
                mm.Bcc = "wolfi@wbs.ae";
                mm.Subject = "Online comments from WBS website visitor, " + TXTFname.Text;
                mm.Body = "<div style='border:solid 2px RED; padding:25px 25px 25px 25px'><br><br> <strong>Online comments from WBS website</strong><br> <br> ------------------------------------- <br> Date : " + dat + "<br> <br> First Name : " + TXTFname.Text + "<br>Last Name : " + TXTLastName.Text + "<br> Email Address : " + TXTEmail.Text + "<br> Contact No : " + TXTMob.Text + "<br> Enquiry Type : " + DrpDwnType.SelectedItem.Text + "<br> <br> <br> The visitor comment : <br> --------------------------------------- <br> " + TXTComment.Text + "</strong><br><br>Further Information : " + RadioButtonList1.SelectedItem.Value.ToString() + "<br><br><br></div>";
                mm.BodyFormat = MailFormat.Html;
                SmtpMail.Send(mm);
                TXTFname.Text = "";
                TXTLastName.Text = "";
                TXTMob.Text = "";
                TXTComment.Text = "";
                TXTEmail.Text = "";
                TXTMess.Text = "Thank you for your interest in WBS!!! ";


        }
    }

I hope this kind of question is not too much bother.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T02:43:08+00:00Added an answer on May 26, 2026 at 2:43 am

    I’m not exactly sure what your question is, but if you are asking on how to set different “To” addresses for the message depending on the value of the drop down then it looks like you are on the right path.

    I might suggest setting the value of the items in the drop down list and then setting the value of mm.To to that.

    <code>
    mm.To = DrpDwnType.SelectedValue;
    </code>
    

    This might help you avoid a bunch of if statements.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Need to change li position by clicking to move up or to move down.
Ok folks, basically I need to change the value of the input (which is
I need to change full html response stream (with html parsing) before it is
I need to change the way MVC is rendering action links(and form's and url's,
I need change background of all text that have two spaces from the start
i need change color of SystemTray.ProgressIndicator color, how i can do it? I tried
I have database, and in one the tables I need change the values of
I use Pjax with tutorial from http://railscasts.com/episodes/294-playing-with-pjax?view=comments I don't need change url and this
I need to change RichEditor and TextEditor modes with JavaScript, now I need to
I need to change database and settings when my customers load the application (xap)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.