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 8433837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:29:49+00:00 2026-06-10T06:29:49+00:00

Using the following function: Public Sub SendMail(ByVal SendFrom As String, ByVal SendTo As String,

  • 0

Using the following function:

Public Sub SendMail(ByVal SendFrom As String, ByVal SendTo As String, ByVal Subject As String, ByVal Body As String)

    Dim client As New SmtpClient
    Dim message As New MailMessage

    message.Body = Body
    message.Subject = Subject
    message.From = New MailAddress(SendFrom)
    message.To.Add(New MailAddress(SendTo))

    client.Port = "25"
    client.Host = "smtp.myserver.com"

    client.Send(message)

End Sub

I call it with

Protected Sub btnSubmit_Click(sender As Object, e As System.EventArgs) Handles btnSubmit.Click

    Dim iandamsb As New StringBuilder

    iandamsb.AppendLine("Please make the following changes:")
    iandamsb.AppendLine("")
    iandamsb.AppendLine("Current name:" & txtCurrentName.Text)
    iandamsb.AppendLine("New name:" & txtNewName.Text)
    iandamsb.AppendLine("New username:" & txtNewUsername.Text)
    iandamsb.AppendLine("Applications:" & txtOtherApplications.Text)

    Dim iandambody As String = iandamsb.ToString

    SendMail(txtRequesterEmail.Text, "ayockel@mydomain.com", "Name Change Request - " & txtCurrentName.Text, iandambody)

End Sub

It works just fine, however it is sending two emails instead of one. Can anyone figure out why it’s sending a duplicate?

  • 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-06-10T06:29:51+00:00Added an answer on June 10, 2026 at 6:29 am

    I would venture to guess that you have the button click event bound twice: once through an OnClick attribute in the markup:

    <asp:Button OnClick="btnSubmit_Click" runat="server" ... />
    

    and then again through the code-behind via Handles:

    Protected Sub btnSubmit_Click(sender As Object, e As System.EventArgs) 
        Handles btnSubmit.Click
    

    I would remove one of them if that’s the case. I would keep the latter so you know that the btnSubmit_Click event is properly wired at compile time.

    A discussion of this issue.

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

Sidebar

Related Questions

Using the following code: Function GetSetting(Of T)(ByVal SettingName As String, ByRef DefaultVal As T)
Given the following code Public Shared Sub DoAsyncAction() Using asmxProxy As New MyAsmxServiceProxy() AddHandler
I have the following function: public ActionResult Index(string caller_id, int? id) { Now I
I have a following code which works fine MsgBox(AddSomething(Of String)(Hello, World)) Public Function AddSomething(Of
Currently i am having following function public int GetVariableValue(TaxReturn taxReturnObj, string identityKey) { int
I have the following function: Public Function CheckHasRoom(people_id As String, semester As String, year
I am using following function to load the page. I have loads of links
I am using following function. Whenever i call it that time it will increase
I want to print an integer number in binary mode using following function: #include
I am using the following function and code to try to get the size

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.