Click here to Skip to main content
15,892,005 members
Home / Discussions / C#
   

C#

 
QuestionClick on WindowPattern Pin
mayraglez1-Jun-10 7:41
mayraglez1-Jun-10 7:41 
QuestionDataTable row column lookup possiblity? Pin
Blubbo1-Jun-10 7:11
Blubbo1-Jun-10 7:11 
AnswerRe: DataTable row column lookup possiblity? Pin
T M Gray1-Jun-10 10:16
T M Gray1-Jun-10 10:16 
GeneralRe: DataTable row column lookup possiblity? Pin
Blubbo2-Jun-10 2:07
Blubbo2-Jun-10 2:07 
AnswerRe: DataTable row column lookup possiblity? Pin
PIEBALDconsult1-Jun-10 13:31
mvePIEBALDconsult1-Jun-10 13:31 
AnswerRe: DataTable row column lookup possiblity? Pin
AspDotNetDev1-Jun-10 17:58
protectorAspDotNetDev1-Jun-10 17:58 
GeneralRe: DataTable row column lookup possiblity? Pin
Blubbo2-Jun-10 2:08
Blubbo2-Jun-10 2:08 
QuestionSend mail through SMTP server Pin
loyal ginger1-Jun-10 7:02
loyal ginger1-Jun-10 7:02 
I am playing with a small program that sends emails through SMTP server. This is a C# Windows Forms application. The main part of the program looks like this:
using System;
using System.Text;
using System.Windows.Forms;
using System.Net.Mail;


namespace test_email_smtp
{
	public partial class send_mail_through_smtp : Form
	{
		public send_mail_through_smtp()
		{
			InitializeComponent();
		}

		private void send_mail_Click(object sender, EventArgs e)
		{
			SmtpClient client = new SmtpClient(smtp_server.Text);
			MailMessage message = new MailMessage(send_from.Text, send_to.Text);
			message.Body = mail_body.Text;
			message.Subject = mail_subject.Text;
			client.Send(message);
			message.Dispose();
		}
	}
}


"send_from", "send_to", "mail_body", "mail_subject", and "smtp_server" are TextBox controls on the Form.

When I ran the program and click the "send" button, and then close the program (by closing the form), the mail is sent IMMEDIATELY.

However, if I click the "send" button and leave the program running (not closing the program), after a minute or so, I will get a message saying "Your mail message was unable to be sent because the connection to your mail server was interrupted. Please open your email client and re-send the message from the Sent Messages folder." This does not happen all the time. I'd say 9 out of 10 times this message was shown. The one time it was not shown, the mail was sent after a long time.

By the way, the message is from "Symantec Email Proxy". When this message was shown, a balloon message was also popped up by the system tray area saying "Scanning message 1 of 1", also from Symantec.

All these problems do not exist if I close the program after I click the "send" button. The mail will be sent immediately. I need the program to keep running after the mail is sent. I can't close the program every time a mail needs to be sent. Any ideas? Thanks!
AnswerRe: Send mail through SMTP server Pin
Abhinav S1-Jun-10 7:52
Abhinav S1-Jun-10 7:52 
GeneralRe: Send mail through SMTP server Pin
loyal ginger1-Jun-10 8:51
loyal ginger1-Jun-10 8:51 
AnswerRe: Send mail through SMTP server Pin
OriginalGriff1-Jun-10 8:22
mveOriginalGriff1-Jun-10 8:22 
GeneralRe: Send mail through SMTP server Pin
loyal ginger1-Jun-10 8:33
loyal ginger1-Jun-10 8:33 
GeneralRe: Send mail through SMTP server Pin
OriginalGriff1-Jun-10 8:41
mveOriginalGriff1-Jun-10 8:41 
GeneralRe: Send mail through SMTP server Pin
Luc Pattyn1-Jun-10 9:11
sitebuilderLuc Pattyn1-Jun-10 9:11 
GeneralRe: Send mail through SMTP server Pin
loyal ginger1-Jun-10 8:48
loyal ginger1-Jun-10 8:48 
GeneralRe: Send mail through SMTP server Pin
OriginalGriff1-Jun-10 8:54
mveOriginalGriff1-Jun-10 8:54 
GeneralRe: Send mail through SMTP server Pin
loyal ginger1-Jun-10 9:14
loyal ginger1-Jun-10 9:14 
GeneralRe: Send mail through SMTP server Pin
Luc Pattyn1-Jun-10 9:59
sitebuilderLuc Pattyn1-Jun-10 9:59 
QuestionFile.Open strange behaviour Pin
ds411-Jun-10 6:46
ds411-Jun-10 6:46 
AnswerRe: File.Open strange behaviour Pin
#realJSOP1-Jun-10 7:38
mve#realJSOP1-Jun-10 7:38 
Questioncount words of office file Pin
jojoba20111-Jun-10 5:54
jojoba20111-Jun-10 5:54 
AnswerRe: count words of office file PinPopular
OriginalGriff1-Jun-10 5:56
mveOriginalGriff1-Jun-10 5:56 
GeneralRe: count words of office file Pin
Luc Pattyn1-Jun-10 6:52
sitebuilderLuc Pattyn1-Jun-10 6:52 
AnswerRe: count words of office file Pin
PIEBALDconsult1-Jun-10 5:57
mvePIEBALDconsult1-Jun-10 5:57 
QuestionRe: count words of office file Pin
jojoba20111-Jun-10 6:10
jojoba20111-Jun-10 6:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.