Email sender not working

0 Vaughan Testa · August 20, 2015
Hey guys, 

I have a quick question and was wondering if some-one may be able to help me out. I've completed the email sender exactly the was it was shown, however I seem to have a problem running it. If I run it in the debugger it doesn't want to run it comes back saying something about the compiler not working, and when I run it as an exe, in the bin folder it opens but freezes, and I'm unsure of what is happening, I'm using visual studio 2015 community if that makes a difference, 


Post a Reply


Oldest  Newest  Rating
0 Vaughan Testa · August 22, 2015
Thanks a lot man really appreciate it.
0 Vaughan Testa · August 22, 2015
Hey Guys, How's everything going.

I have just figured out why visual studio wasn't working and it looks like it was my computer, I just installed visual studio on another computer and its working. Lenovo isn't that great. LOL 
Anyway I seem to be stuck with something else now, the application is working but not sending. I get a message from Gmail saying someone tried accessing my account.. Here is the code I have and was wondering If you could help.

please bear in mind I'm still learning so the project may look easy and a bit untidy but that's why I'm here, To learn from others.

using System.Net.Mail;
using System.Net;

namespace Sending_Emails
    public partial class Form1 : Form
        public Form1()

        private void button1_Click(object sender, EventArgs e)
                if (!textBox4.Text.Contains(""))
                    MessageBox.Show("Please Proveide a gmail address", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                button1.Enabled = false;
                MailMessage message = new MailMessage();
                message.From = new MailAddress(textBox4.Text);
                message.Subject = textBox2.Text;
                message.Body = textBox3.Text;
                foreach (string s in textBox1.Text.Split(';'))
                SmtpClient client = new SmtpClient();
                client.Credentials = new NetworkCredential(textBox4.Text, textBox5.Text);
                client.Host = "";
                client.Port = 587;
                client.EnableSsl = true;
            catch { MessageBox.Show("There was an error sending the massage.\r\nPlease Make Sure That Your Credentials are Correct\r\nAnd that you have an internet conection.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); }
            finally { button1.Enabled = true; }


Thanks Guys.
0 Vaughan Testa · August 21, 2015
Hi Jethro 

Thanks for the reply. There isn't any code at the moment, I haven't begun to code. All I've done at the moment was design the layout of the windows form and that's it. I've actually spoke to a friend about this problem and he said it might be the computer itself and not visual studio. I honestly have no idea.

Thanks Man
0 jethro daniel · August 21, 2015
Show us your code!..The programme in that video should run!!.The problem might be from your code
0 Vaughan Testa · August 21, 2015
Hi Clark Thanks for the info, I appreciate it. 

I just preformed the call stack and there isn't anything its empty, I then had a look at the output tab and it says The thread 0xdac has exited with code 0 (0x0). 

And that's it there isn't anything else that pops up. 

0 Vaughan Testa · August 21, 2015
Hey Clark Thanks for the reply 

Sorry I'm still new everything and don't know much. If I debug the program in visual studio it doesn't want to run it comes back with the following window saying:

vshost32.exe has stopped working A problem caused the program to stop working correctly. then gives an option to OK it or Debug it. When I click on Debug a warning pops up saying:

A debugger is attached to the EmailSender.vshost.exe but not configured to debug this unhandled exception. To debug this exception, detach the current debugger. then click OK Windows will close the program and notify you if a solution is available.

When I run it as an exe, in the bin folder it opens but freezes once I hit send, and I'm unsure of what is happening, I am new to the programming world and I may be doing something wrong but there are no signs of any errors. I'm using Visual Studio 2015 Community if that makes a difference.

The project I did was the one on this site here is the link to the project.

I hope this Helps.
  • 1



C# is an object-oriented language designed for improving the development of web applications.