# Send Email

**URL:** https://www.finalbuilder.com/forums/t/send-email/417
**Category:** Discussion
**Created:** [March 29, 2007, 7:50am UTC](https://www.finalbuilder.com/forums/t/send-email/417 "2007-03-29T07:50:37Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [March 29, 2007, 7:50am UTC](https://www.finalbuilder.com/forums/t/send-email/417/1 "2007-03-29T07:50:37Z")

</div>

Hi,

I am not able to send email with the send email action. I tried to do a little application in c# and it's working fine.

Here is the code :

&nbsp;

&nbsp;&nbsp;&nbsp;&nbsp;MailMessage msg = new MailMessage();  
&nbsp;&nbsp;&nbsp;&nbsp;msg.From = "email1@wonderware.com";  
&nbsp;&nbsp;&nbsp;&nbsp;msg.To = "eamil1@wonderware.com";  
&nbsp;&nbsp;&nbsp;&nbsp;msg.Subject = "tes";  
&nbsp;&nbsp;&nbsp;&nbsp;msg.Body = "klklk";  
&nbsp;&nbsp;&nbsp;&nbsp;msg.BodyFormat = MailFormat.Text; // can be MailFormat.HTML

&nbsp;&nbsp;&nbsp;&nbsp;/\* you can ignore following line for encoding, .NET will use your PC default text encoding \*/  
&nbsp;&nbsp;&nbsp;&nbsp;//msg.BodyEncoding = System.Text.Encoding.GetEncoding("iso-8859-2");

&nbsp;&nbsp;&nbsp;&nbsp;/\* if you need attachment \*/  
&nbsp;&nbsp;&nbsp;&nbsp;MailAttachment ma = new System.Web.Mail.MailAttachment("c:\\doc\\test.txt");  
&nbsp;&nbsp;&nbsp;&nbsp;msg.Attachments.Add(ma);  
&nbsp;&nbsp;&nbsp;&nbsp;/\* end attachment\* section \*/  
&nbsp;&nbsp;&nbsp;&nbsp;msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "2");&nbsp;//basic authentication  
&nbsp;&nbsp;&nbsp;&nbsp;msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "Username");//this.username.Text); //set your username here  
&nbsp;&nbsp;&nbsp;&nbsp;msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "Password");//this.password.Text);&nbsp;//set your password here

&nbsp;&nbsp;&nbsp;&nbsp;msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", "25");  
&nbsp;&nbsp;&nbsp;&nbsp;// - smtp.gmail.com use STARTTLS (some call this SSL)  
&nbsp;&nbsp;&nbsp;&nbsp;//msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpusessl", "true");

&nbsp;&nbsp;&nbsp;&nbsp;SmtpMail.SmtpServer = "SMTP Server"; //assign smtp server here  
&nbsp;&nbsp;&nbsp;&nbsp;SmtpMail.Send(msg); //this line actually fire the msg out

There is something in the configuration the smtp.authenticate that is set to 2.. else it is not working. Should this be the problem that i have?

Thank you,

Alexis

---

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [March 29, 2007, 8:13am UTC](https://www.finalbuilder.com/forums/t/send-email/417/2 "2007-03-29T08:13:37Z")

</div>

Finally i arrived to make it works. Without authenticate checked it works. Our smtp server needs authentification but i think that without authenticate checked it takes the windows user credential.

But maybe there is something special because in my code example it is working with the same username and password that i was using in the send email action.

It is working, but i want to know why it was'nt before...

thank you

---

<div class="post-metadata">

### Author: ![angus](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/a/b3f665/32.png) [@angus](https://www.finalbuilder.com/forums/u/angus)
#### Post date: [March 30, 2007, 1:24am UTC](https://www.finalbuilder.com/forums/t/send-email/417/3 "2007-03-30T01:24:29Z")

</div>

Hi Alexis,  
  
What SMTP server are you using? Could your SMTP server be requiring either SSL-encrypted authentication or no authentication at all?  
  
- Angus

---

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [March 30, 2007, 5:45am UTC](https://www.finalbuilder.com/forums/t/send-email/417/4 "2007-03-30T05:45:26Z")

</div>

Our smtp server is a microsoft exchange and we must be authenticated to be able to send an email, i don't know if it is using SSL or not.

If you don't know the reason, it doesn't matter, it works but not the way that i was expected.

Thanks you for your time,

Alexis
