Click here to Skip to main content
15,895,656 members
Home / Discussions / C#
   

C#

 
GeneralRe: Cross Thread operation is not Valid Pin
emran8345-Mar-06 12:03
emran8345-Mar-06 12:03 
GeneralRe: Cross Thread operation is not Valid Pin
mikanu5-Mar-06 12:26
mikanu5-Mar-06 12:26 
GeneralRe: Cross Thread operation is not Valid Pin
emran8345-Mar-06 15:16
emran8345-Mar-06 15:16 
GeneralRe: Cross Thread operation is not Valid Pin
mikanu6-Mar-06 13:20
mikanu6-Mar-06 13:20 
QuestionSystem.Drawing.Graphics question Pin
QzRz5-Mar-06 9:07
QzRz5-Mar-06 9:07 
AnswerRe: System.Drawing.Graphics question Pin
Guffa5-Mar-06 9:11
Guffa5-Mar-06 9:11 
GeneralRe: System.Drawing.Graphics question Pin
QzRz5-Mar-06 9:21
QzRz5-Mar-06 9:21 
QuestionSending an e-mail Pin
steve_rm5-Mar-06 6:05
steve_rm5-Mar-06 6:05 
Hello,

I am trying to create an e-mail application. I have created a simple mail application in win forms. The user will put in the fields and click the send button.

I am not really sure how an e-mail application works. But if send an e-mail to my e-mail account i.e. steve1_rm@hotmail.com. I send the e-mail. However, I never receive the e-mail that I send using this mail application. The application works ok, and there are no run-time errors. Is there something I need to do, to be able to send this to my hotmail, yahoo, or gmail e-mail accounts.

The code I have used is below. This has been written in C# Visual Studio 2005.

Thanks in advance

<br />
using System.Web.Mail;<br />
<br />
private void btnSend_Click(object sender, EventArgs e)<br />
        {<br />
            try<br />
            {<br />
                //Construct a new mail message and fill it with information from the form<br />
                MailMessage aMessage = new MailMessage();<br />
                aMessage.From = txtFrom.Text;<br />
                aMessage.To = txtTo.Text;<br />
                aMessage.Cc = txtCC.Text;<br />
                aMessage.Bcc = txtBCC.Text;<br />
                aMessage.Subject = txtSubject.Text;<br />
                aMessage.Body = txtMessage.Text;<br />
<br />
                //If an attachment file is indicated, create it and add it to the message<br />
                if (txtAttachment.Text.Length > 0)<br />
                {<br />
                    aMessage.Attachments.Add(new MailAttachment(txtAttachment.Text, MailEncoding.Base64));<br />
                }<br />
<br />
                //Now send the message<br />
                SmtpMail.Send(aMessage);<br />
<br />
                //Indicate that the message has been sent<br />
                MessageBox.Show("Message sent to " + txtTo.Text, "E-mail Program", MessageBoxButtons.OK, MessageBoxIcon.Information);<br />
            }<br />
            catch (Exception ex)<br />
            {<br />
                MessageBox.Show(ex.Message.ToString());<br />
            }<br />

AnswerRe: Sending an e-mail Pin
Guffa5-Mar-06 8:42
Guffa5-Mar-06 8:42 
AnswerRe: Sending an e-mail Pin
Sean895-Mar-06 12:47
Sean895-Mar-06 12:47 
QuestionRe: Sending an e-mail Pin
steve_rm5-Mar-06 20:49
steve_rm5-Mar-06 20:49 
AnswerRe: Sending an e-mail Pin
albCode5-Mar-06 21:12
albCode5-Mar-06 21:12 
AnswerRe: Sending an e-mail Pin
Sebastian Schneider5-Mar-06 23:41
Sebastian Schneider5-Mar-06 23:41 
QuestionRe: Sending an e-mail Pin
steve_rm6-Mar-06 0:48
steve_rm6-Mar-06 0:48 
AnswerRe: Sending an e-mail Pin
albCode6-Mar-06 3:06
albCode6-Mar-06 3:06 
QuestionRe: Sending an e-mail Pin
steve_rm6-Mar-06 16:08
steve_rm6-Mar-06 16:08 
QuestionUSB Port Pin
Sean895-Mar-06 4:58
Sean895-Mar-06 4:58 
AnswerRe: USB Port Pin
Ed.Poore5-Mar-06 6:56
Ed.Poore5-Mar-06 6:56 
GeneralRe: USB Port Pin
Sean895-Mar-06 9:13
Sean895-Mar-06 9:13 
AnswerRe: USB Port Pin
eggie55-Mar-06 20:24
eggie55-Mar-06 20:24 
QuestionForm - Handle Pin
AJ1235-Mar-06 4:44
AJ1235-Mar-06 4:44 
AnswerRe: Form - Handle Pin
Stanciu Vlad5-Mar-06 6:23
Stanciu Vlad5-Mar-06 6:23 
GeneralRe: Form - Handle Pin
AJ1235-Mar-06 9:09
AJ1235-Mar-06 9:09 
GeneralRe: Form - Handle Pin
Stanciu Vlad5-Mar-06 9:27
Stanciu Vlad5-Mar-06 9:27 
GeneralRe: Form - Handle Pin
Gavin Taylor5-Mar-06 18:49
professionalGavin Taylor5-Mar-06 18:49 

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.