Search Results

Search found 133 results on 6 pages for 'mailmessage'.

Page 3/6 | < Previous Page | 1 2 3 4 5 6  | Next Page >

  • code to send email

    - by Alexander
    What am I doing wrong here? private void SendMail(string from, string body) { string mailServerName = "plus.pop.mail.yahoo.com"; MailMessage message = new MailMessage(from, "[email protected]", "feedback", body); SmtpClient mailClient = new SmtpClient(); mailClient.Host = mailServerName; mailClient.Send(message); message.Dispose(); } I got the following error: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 209.191.108.191:25

    Read the article

  • Is .net 4.0 really not capable of sending emails with attachments larger than 3MB's

    - by JL
    I recently had an issue after upgrading my .net framework to 4.0 from 3.5, I did this because in 4.0 the SMTPClient finally sends a QUIT command to the SMTP server. However recently I was most disturbed to run into a base64 decoding issue, when sending out emails with attachments larger than 3MB's using .net v4 smtpclient: System.Net.Mail.SmtpException: Failure sending mail. --- System.IndexOutOfRangeException: Index was outside the bounds of the array. at System.Net.Base64Stream.EncodeBytes(Byte[] buffer, Int32 offset, Int32 count, Boolean dontDeferFinalBytes, Boolean shouldAppendSpaceToCRLF) at System.Net.Base64Stream.Write(Byte[] buffer, Int32 offset, Int32 count) at System.Net.Mime.MimePart.Send(BaseWriter writer) at System.Net.Mime.MimeMultiPart.Send(BaseWriter writer) at System.Net.Mail.Message.Send(BaseWriter writer, Boolean sendEnvelope) at System.Net.Mail.SmtpClient.Send(MailMessage message) --- End of inner exception stack trace --- I read this connect bug listing here: http://connect.microsoft.com/VisualStudio/feedback/details/544562/cannot-send-e-mails-with-large-attachments-system-net-mail-smtpclient-system-net-mail-mailmessage and also this bug listing here: http://connect.microsoft.com/VisualStudio/feedback/details/102644/system-net-mail-fails-to-send-index-was-outside-the-bounds-of-the-array So my question is - is .net 4.0 RTM really not capable of such an easy task as sending a message with an attachment larger than 3MB's?

    Read the article

  • Is there way to see if System.Net.Mail worked

    - by eski
    I'm using System.Net.Mail to send email, like so : MailMessage message = new MailMessage(); message.From = new MailAddress("[email protected]"); message.To.Add(new MailAddress("[email protected]")); message.Subject = "Hello"; message.Body = "This is a nice body.."; SmtpClient client = new SmtpClient(); client.Send(message); How can i know if the E-mail was sent, can i put in a if sentence to check it out ? What would it look like then ?

    Read the article

  • .NET 4.0 Fails When sending emails with attachments larger than 3MB

    - by JL
    I recently had an issue after upgrading my .net framework to 4.0 from 3.5: System.Net.Mail.SmtpException: Failure sending mail. --- System.IndexOutOfRangeException: Index was outside the bounds of the array. at System.Net.Base64Stream.EncodeBytes(Byte[] buffer, Int32 offset, Int32 count, Boolean dontDeferFinalBytes, Boolean shouldAppendSpaceToCRLF) at System.Net.Base64Stream.Write(Byte[] buffer, Int32 offset, Int32 count) at System.Net.Mime.MimePart.Send(BaseWriter writer) at System.Net.Mime.MimeMultiPart.Send(BaseWriter writer) at System.Net.Mail.Message.Send(BaseWriter writer, Boolean sendEnvelope) at System.Net.Mail.SmtpClient.Send(MailMessage message) --- End of inner exception stack trace --- I read this connect bug listing here: http://connect.microsoft.com/VisualStudio/feedback/details/544562/cannot-send-e-mails-with-large-attachments-system-net-mail-smtpclient-system-net-mail-mailmessage. If anyone cares about this issue, please vote for it on Connect, so it will be fixed sooner.

    Read the article

  • send multiple emails

    - by nccsbim071
    i am sending email to the users using smtp client and MailMessage class. i have been adding the addresses of multiple receivers in the to property of the object of MailMessage class. the problem is that the receiver can see the email addresses of other receipents. is there any way to hide the email addresses of other receipents. i mean setting some property or something like that. otherwise i will be left with only option to send individual email to the users. any help plesae

    Read the article

  • Email goes to spam

    - by VICKY Shastri
    i am creating an simple mail sending application in c# windows form application. My application works well but when i send email to my yahoo account it goes to spam not in inbox but if i send email to gmail it goes to inbox. please tell me what i need to do to send email in inbox below is my code: try { // setup mail message MailMessage message = new MailMessage(); message.From = new MailAddress(textBox1.Text); message.To.Add(new MailAddress(textBox2.Text)); message.Subject = textBox3.Text; message.Body = richTextBox1.Text; // setup mail client SmtpClient mailClient = new SmtpClient("smtp.mail.yahoo.com"); mailClient.Credentials = new NetworkCredential(textBox1.Text, "password"); // send message mailClient.Send(message); MessageBox.Show("Sent"); } catch(Exception) { MessageBox.Show("Error"); }

    Read the article

  • send smtp email through godaddy

    - by Danni
    So, I'm trying to send an smtp email from my website as a confirmation that their order has been place. The site is hosted on godaddy and I have no idea what's going on. I'm getting all kinds of error messages. The current one is: "System.Net.Mail.SmtpException: Mailbox name not allowed. The server response was: sorry, your mail was administratively denied. (#5.7.1)" My code is: string body = "Your order was placed"; MailMessage objEmail1 = new MailMessage("[email protected]", userEmail, "Confirmation Email", body); objEmail1.IsBodyHtml = true; SmtpClient client = new SmtpClient(); client.Host = "relay-hosting.secureserver.net"; client.UseDefaultCredentials = false; client.Send(objEmail1); I think the problem lies in the from address not belonging to godaddy or with the client.Host. Ideas?

    Read the article

  • Are there .NET Framework methods to parse an email (MIME)?

    - by Neil C. Obremski
    Is there a class or set of functions built into the .NET Framework (3.5+) to parse raw emails (MIME documents)? I am not looking for anything fancy or a separate library, it needs to be built-in. I'm going to be using this in some unit tests and need only grab the main headers of interest (To, From, Subject) along with the body (which in this case will always be text and therefore no MIME trees or boundaries). I've written several MIME parsers in the past and if there isn't anything readily available, I'll just put together something from regular expressions. It would be great to be able to do something like: MailMessage msg = MailMessage.Parse(text); Thoughts?

    Read the article

  • Authentication Error in C# Send Mail App

    - by doc
    I'm developing a simple send mail app in C#, using my CMail Server: MailMessage mail = new MailMessage("[email protected]", "[email protected]"); mail.Subject = "Sub"; mail.Body = "Hi!"; SmtpClient smtp = new SmtpClient("MyServer"); System.Net.NetworkCredential cred = new System.Net.NetworkCredential("user", "pass"); smtp.UseDefaultCredentials = false; smtp.Credentials = cred; smtp.Send(mail); Obviously i ommited my account information, so, this code throws me an Authentication Exception for some reason. I first thought that the code was wrong, so i change the info to my gmail account and everything goes fine, with the only SMTP server that i having trouble is with the CMail. Is there a problem with .NET and CMail's SMTP ? Thanks for the help and comments!

    Read the article

  • smtp exception "failure sending mail" in C#.net

    - by Ajay_Kumar
    Hello, I am making smtp mail application c#.net.This is working ok for Gmail setting but i have to work it for VSNL connection.I am getting an error exception "Failure sending mail" my setting seems looks perfect.What is the exact problem ? why this exception coming ? Thanks MailMessage mailMsg = new MailMessage(); MailAddress mailAddress = new MailAddress("[email protected]"); mailMsg.To.Add(textboxsecondry.Text); mailMsg.From = mailAddress; // Subject and Body mailMsg.Subject = "Testing mail.."; mailMsg.Body = "connection testing.."; SmtpClient smtpClient = new SmtpClient("smtp.vsnl.net", 25); System.Net.NetworkCredential credentials = new System.Net.NetworkCredential("[email protected]", "password"); smtpClient.EnableSsl = true; smtpClient.UseDefaultCredentials = false; smtpClient.Credentials = credentials; smtpClient.Send(mailMsg);

    Read the article

  • An existing connection was forcibly closed by the remote host

    - by Alexander
    I am about to give up debugging SMTP servers to send email... My code is the following private void SendMail() { SmtpClient mailClient = new SmtpClient("smtp.mail.yahoo.com", 465); mailClient.EnableSsl = true; MailMessage message = new MailMessage(); message.To.Add("[email protected]"); message.Subject = "i wish it would work"; MailAddress fromAddress = new MailAddress(Email.Text, Name.Text); message.From = fromAddress; mailClient.Send(message); }

    Read the article

  • .NET System.Net.Mail messages are always being flagged junk, on internal server.

    - by jamone
    I'm using System.Net.Mail to send out a few emails. The emails are being sent by our internal mail server to local addresses. However all of the messages are going straight to junk in Outlook. The messages are being sent from valid email addresses. What would be causing our our servers to label it as junk? MailMessage msg = new MailMessage(); msg.IsBodyHtml = true; msg.Subject = subject; msg.Body = body; msg.From = new MailAddress(from); msg.To.Add(to); SmtpClient client = new SmtpClient(server, 25); client.Send(msg);

    Read the article

  • Adding a html file into a c# email app

    - by neilos
    using System; using System.Net; using System.Net.Mail; class MainClass { public static void Main(string[] args) { SmtpClient client = new SmtpClient("192.168.1.12", 25); using (MailMessage msg = new MailMessage()) { msg.From = new MailAddress("[email protected]"); msg.Subject = "***Dexter DB***"; msg.Body = "***DB backup done***"; // I want to change this so i can do this in html file - how do i pick up this file and send a html form? msg.To.Add(new MailAddress("[email protected]")); client.Send(msg); } } }

    Read the article

  • Sending E-Mail in C#

    - by pm_2
    I’m using .NET 3.5, and I want to automatically send a mail. I’m currently using the following: Microsoft.Office.Interop.Outlook.MailItem mailMsg = (Microsoft.Office.Interop.Outlook.MailItem)outlookApplication.CreateItem( Microsoft.Office.Interop.Outlook.OlItemType.olMailItem); mailMsg.To = recipient; mailMsg.Subject = subject; mailMsg.Body = body; mailMsg.Send(); However, I’ve found several articles that seem to imply I should be using the following method: System.Net.Mail.MailMessage mailMsg = new System.Net.Mail.MailMessage(); mailmsg.To = recipient; mailmsg.Subject = subject; mailmsg.Body = body; Can anyone tell me what the difference between the two namespaces if, and why you might want to use one over the other?

    Read the article

  • Detecting if someone is in a room in your house and sending you an email.

    - by mbcrump
    Let me setup this scenario: You are selling your house. You have small children. (Possibly 2 rug rats or more) The real estate company calls and says they have a showing for your house between the hours of 3pm-6pm. You have to keep the children occupied. You realize this is the 5th time you have shown your house this week. What is a programmer to do?……Setup a webcam, find a motion detection software that has support to launch a program and of course, Visual Studio 2010. First, comes the tools Some sort of webcam, I chose the WinBook because a friend of mine loaned it to me. It is a basic USB2.0 camera that supports 640x480 without software.  Next up was find webcam software that supports launching a program. WebcamXP support this. VS 2010 Console Application. A cell phone that you can check your email. You may be asking, why write code to send the email when a lot of commercial software motion detection packages include that as base functionality. Well, first it cost money and second I don’t want the picture of the person as that probably invades privacy and as a future buyer, I don’t want someone recording me in their house. Now onto the show... First, the code part. We are going to create a VS2010 or whatever version you have installed and use the following code snippet. Code Snippet using System; using System.Net.Mail; using System.Net;     namespace MotionDetectionEmailer {     class Program     {         static void Main(string[] args)         {             try             {                 MailMessage m = new MailMessage                    ("[email protected]",                     "[email protected]",                     "Motion Detected at " + DateTime.Now,                     "Someone is in the downstairs basement.");                 SmtpClient client = new SmtpClient("smtp.charter.net");                 client.Credentials = new NetworkCredential("mbcrump", "NOTTELLINGYOU");                 client.Send(m);             }               catch (SmtpException ex)             {                 Console.WriteLine("Who cares?? " + ex.ToString());             }         }       } } Second, Download and install wecamxp and select the option to launch an external program and you are finished. Now, when you are at MCDonalds and can check your email on your phone, you will see when they entered the house and you can go back home without waiting the full 3 hours. --- NICE!

    Read the article

  • Send mail on event log error trigger safe check frequency

    - by Zeb Rawnsley
    I want to use powershell to alert me when an error occurs in the event viewer on my new Win2k12 Standard Server, I was thinking I could have the script execute every 10mins but don't want to put any strain on the server just for event log checking, here is the powershell script I want to use: $SystemErrors = Get-EventLog System | Where-Object { $_.EntryType -eq "Error" } If ($SystemErrors.Length -gt 0) { Send-MailMessage -To "[email protected]" -From $env:COMPUTERNAME + @company.co.nz" -Subject $env:COMPUTERNAME + " System Errors" -SmtpServer "smtp.company.co.nz" -Priority High } What is a safe frequency I can run this script at without hurting my server? Hardware: Intel Xeon E5410 @ 2.33GHz x2 32GB RAM 3x 7200RPM S-ATA 1TB (2x RAID1) Edit: With the help of Mathias R. Jessen's answer, I ended up attaching an event to the application & system log with the following script: Param( [string]$LogName ) $ComputerName = $env:COMPUTERNAME; $To = "[email protected]" $From = $ComputerName + "@company.co.nz"; $Subject = $ComputerName + " " + $LogName + " Error"; $SmtpServer = "smtp.company.co.nz"; $AppErrorEvent = Get-EventLog $LogName -Newest 1 | Where-Object { $_.EntryType -eq "Error" }; If ($AppErrorEvent.Length -eq 1) { $AppErrorEventString = $AppErrorEvent | Format-List | Out-String; Send-MailMessage -To $To -From $From -Subject $Subject -Body $AppErrorEventString -SmtpServer $SmtpServer -Priority High; };

    Read the article

  • C# SMTP virtual server doesn't send mail [closed]

    - by ragaei
    I have got the following Exception : System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. - System.Runtime.InteropServices.COMException (0x8004020F): The server rejected one or more recipient addresses. The server response was: 550 5.7.1 Unable to relay for [email protected] --- End of inner exception stack trace --- at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters) at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams) at System.Type.InvokeMember(String name, BindingFlags, invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture) at System.Web.Mail.SmtpMail.LateBoundAccessHelper.CallMethod(Type type, Object obj, String methodName, Object[] args) at System.Web.Mail.SmtpMail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args) public static void SendEmail(string _FromEmail, string _ToEmail, string _Subject, string _EmailBody) { // setup email header . SmtpMail.SmtpServer = "127.0.0.1"; MailMessage _MailMessage = new MailMessage(); _MailMessage.From = _FromEmail; _MailMessage.To = _ToEmail; _MailMessage.Subject = _Subject; _MailMessage.Body = _EmailBody; try { SmtpMail.Send(_MailMessage); } catch (Exception ex) { if (ex.InnerException != null) { String str = ex.InnerException.ToString(); } } }

    Read the article

  • Send Email via Google Apps in C#

    - by NateReid
    Hello, I am trying to send a basic email through Google Apps/Gmail using C# (System.Net.Mail/Framework 4) and I am having trouble doing so. I am receiving the following exception: "The operation has timed out." My code is below: //Create the mail message MailMessage mail = new MailMessage(); //Set the addresses mail.From = new MailAddress("[email protected]", "My Name"); mail.To.Add(Email); //Set the subject and bodycontent mail.Subject = "Email Testing"; mail.Body = "This is the body of the email"; //Send the message using the SmtpClient SmtpClient smtp = new SmtpClient(); smtp.EnableSsl = true; smtp.Send(mail); My web.config has the following settings: <smtp from="[email protected]" deliveryMethod="Network"> <network host="smtp.gmail.com" password="password" port="587" userName="[email protected]" /> </smtp> During my troubleshooting I have tried: Using my personal gmail address as well as another from a domain hosted through Google Apps. Using ports 25, 465, and 587 Hard coding the config settings in the c# code instead of using the web.config Sending and telneting from multiple network locations to ensure the firewall/ISP was not blocking it Ensured that POP was enabled in the GMail settings (according to Google this should turn on the ability to send using SMTP) Changing the send from and replyTo address to ensure they match the account (apparently a GMail necessity). I am able to send and receive email fine through the GMail interface for both of my email accounts. I have also tried the settings and solutions offered in Question # 757987 to no avail. Any suggestions would be greatly appreciated. Thanks all.

    Read the article

  • Best practise to send mass email within application (ASP.NET MVC 2, C#)?

    - by gurdan
    Whats the best way to implement mass email sending feature within web app? Two major cases: Email messages for separate registered users depending on their activities (just sending short reminders to user for ex about new posts in his created topic) "Send email for all registered users" functionality, it will be nice to have feature for system administrator to send some messages for all registered users. Of course adding all emails to recipient isn't the way we can go, because email addresses for each user are anonimous. As i understand for case nr1 there is no problem just create some email message via System.Net.Mail by creating new mail message and sending it... but what about case nr 2??? i guess smth like this: foreach(var emailAddress in emailAddresses) { MailMessage mail = new MailMessage(); mail.From = new MailAddress("[email protected]"); mail.To.Add(emailAddress); mail.Subject = "test"; mail.Body = "test"; SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587); smtp.Send(mail); } isn't the good way :) so the question is what is the best way to achieve this ? btw we have no possiblity to deploy some serive for email sending, this should be integrated into web application.

    Read the article

  • Output asp.net masterpage webform to html email

    - by Steve McCall
    Hi I'm having a bit of a nightmare here! I'mv trying output a webform to html using page.rendercontrol and htmltextwriter but it is resulting in a blank email. Code: StringBuilder sb = new StringBuilder(); StringWriter sw = new StringWriter(sb); HtmlTextWriter htmlTW = new HtmlTextWriter(sw); page.RenderControl(htmlTW); String content = sb.ToString(); MailMessage mail = new MailMessage(); mail.From = new MailAddress("[email protected]"); mail.To.Add("[email protected]"); mail.IsBodyHtml = true; mail.Subject = "Test"; mail.Body = content; SmtpClient smtp = new SmtpClient("1111"); smtp.Send(mail); Response.Write("Message Sent"); I also tried it by rendering a single textbox and got and error saying It needed to be within form tags (which are on the masterpage). I tried this fix: http://forums.asp.net/p/1016960/1368933.aspx#1368933 and added: public override void VerifyRenderingInServerForm(Control control) { return; } But now the errror I get is: VerifyRenderingInServerForm(Control)': no suitable method found to override Does anyone have a fix for this? I'm tearing my hair out!! Thanks, Steve

    Read the article

  • using System.Net.Mail To send smtp mail via google gets me a time out exception.

    - by Anicho
    Hey guys, I guess I got another asp.net question I am trying to send email using smtp authentication through google but I am constantly getting a timed out error and no idea what it might be from the following code its not my firewall or my isp blocking smtp ports so its most probably the code: MailMessage msg = new MailMessage(); String BodyMsg; BodyMsg = "Hey " + TxtBoxUsername.Text + "@" + "Welcome to Tiamo your username and password are:@Username: " + TxtBoxUsername.Text + "@Password: " + PasswordString + "@You have succesffully registered, you can now login." + "@Thank You@Tiamo Team"; BodyMsg = BodyMsg.Replace("@", System.Environment.NewLine); msg.To.Add(new MailAddress(TxtBoxEmail.Text)); msg.From = new MailAddress("[email protected]"); msg.Subject = "Re: Welcome to Tiamo"; msg.Body = BodyMsg; SmtpClient client = new SmtpClient() ; client.EnableSsl = true; client.Send(msg); and this is my web.config email smtp settings: <system.net> <mailSettings> <smtp from="[email protected]"> <network host="smtp.gmail.com" port="465" userName="[email protected]" password="MyLovelyPassword" defaultCredentials="true"/> </smtp> </mailSettings> Im completely exhausted so I thought the best thing is to pop up a question, hope you can help it will all be much appreciated... thanks anicho.

    Read the article

  • Sending email with attachments from C#, attachments arrive as Part 1.2 in Thunderbird

    - by Jon
    I have a C# application which emails out Excel spreadsheet reports via an Exchange 2007 server using SMTP. These arrive fine for Outlook users, but for Thunderbird and Blackberry users the attachments have been renamed as "Part 1.2". I found this article which describes the problem, but doesn't seem to give me a workaround. I don't have control of the Exchange server so can't make changes there. Is there anything I can do on the C# end? I have tried using short filenames and HTML encoding for the body but neither made a difference. My mail sending code is simply this: public static void SendMail(string recipient, string subject, string body, string attachmentFilename) { SmtpClient smtpClient = new SmtpClient(); NetworkCredential basicCredential = new NetworkCredential(MailConst.Username, MailConst.Password); MailMessage message = new MailMessage(); MailAddress fromAddress = new MailAddress(MailConst.Username); // setup up the host, increase the timeout to 5 minutes smtpClient.Host = MailConst.SmtpServer; smtpClient.UseDefaultCredentials = false; smtpClient.Credentials = basicCredential; smtpClient.Timeout = (60 * 5 * 1000); message.From = fromAddress; message.Subject = subject; message.IsBodyHtml = false; message.Body = body; message.To.Add(recipient); if (attachmentFilename != null) message.Attachments.Add(new Attachment(attachmentFilename)); smtpClient.Send(message); } Thanks for any help.

    Read the article

  • Performance problem with System.Net.Mail

    - by Saif Khan
    I have this unusual problem with mailing from my app. At first it wasn't working (getting unable to relay error crap) anyways I added the proper authentication and it works. My problem now is, if I try to send around 300 emails (each with a 500k attachment) the app starts hanging around 95% thru the process. Here is some of my code which is called for each mail to be sent Using mail As New MailMessage() With mail .From = New MailAddress(My.Resources.EmailFrom) For Each contact As Contact In Contacts .To.Add(contact.Email) Next .Subject = "Accounting" .Body = My.Resources.EmailBody 'Back the stream up to the beginning orelse the attachment 'will be sent as a zero (0) byte file. attachment.Seek(0, SeekOrigin.Begin) .Attachments.Add(New Attachment(attachment, String.Concat(Item.Year, Item.AttachmentType.Extension))) End With Dim smtp As New SmtpClient("192.168.1.2") With smtp .DeliveryMethod = SmtpDeliveryMethod.Network .UseDefaultCredentials = False .Credentials = New NetworkCredential("username", "password") .Send(mail) End With End Using With item .SentStatus = True .DateSent = DateTime.Now.Date .Save() End With Return I was thinking, can I just prepare all the mails and add them to a collection then open one SMTP conenction and just iterate the collection, calling the send like this Using mail As New MailMessage() ... MailCollection.Add(mail) End Using ... Dim smtp As New SmtpClient("192.168.1.2") With smtp .DeliveryMethod = SmtpDeliveryMethod.Network .UseDefaultCredentials = False .Credentials = New NetworkCredential("username", "password") For Each mail in MainCollection .Send(mail) Next End With

    Read the article

  • Sending Email through Gmail

    - by persistence
    I am writing a program that send an email through GMail but I have serious Operation timeout error. What is the likely cause. class Mailer { MailMessage ms; SmtpClient Sc; public Mailer() { Sc = new SmtpClient("smtp.gmail.com"); //Sc.Credentials = CredentialCache.DefaultNetworkCredentials; Sc.EnableSsl = true; Sc.Port =465; Sc.Timeout = 900000000; Sc.DeliveryMethod = SmtpDeliveryMethod.Network; Sc.UseDefaultCredentials = false; Sc.Credentials = new NetworkCredential("uid", "mypss"); } public void MailTodaysBirthdays(List<Celebrant> TodaysCelebrant) { int i = TodaysCelebrant.Count(); foreach (Celebrant cs in TodaysCelebrant) { //if (IsEmail(cs.EmailAddress.ToString().Trim())) //{ ms = new MailMessage(); ms.To.Add(cs.EmailAddress); ms.From = new MailAddress("uid","Developers",System.Text.Encoding.UTF8); ms.Subject = "Happy Birthday "; String EmailBody = "Happy Birthday " + cs.FirstName; ms.Body = EmailBody; ms.Priority = MailPriority.High; try { Sc.Send(ms); } catch (Exception ex) { Sc.Send(ms); BirthdayServices.LogEvent(ex.Message.ToString(),EventLogEntryType.Error); } //} } } }

    Read the article

  • ASP MVC: Sending an E-mail

    - by wh0emPah
    Okay I'm kindoff new to the .NET platform. And currently i'm learning ASP MVC. I want to send an e-mail from my program and i have the following code: public void sendVerrificationEmail() { //create the mail message MailMessage mail = new MailMessage(); //set the addresses mail.From = new MailAddress("[email protected]"); mail.To.Add("[email protected]"); //set the content mail.Subject = "This is an email"; mail.Body = "this is a sample body with html in it. <b>This is bold</b> <font color=#336699>This is blue</font>"; mail.IsBodyHtml = true; //send the message SmtpClient smtp = new SmtpClient("127.0.0.1"); smtp.Send(mail); } Now when i execute this code i'll get the following exception: System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:25 Now i'm very very new to the IIS manager & stuff. so there is probably something wrong there. Do i need to install a virtual smtp server or something?. Currently i have following settings (sorry not allowed to uplaod images yet =) ): http://img153.imageshack.us/img153/695/capture2p.png I've been looking for a few hours now but i can't seem to find a working solution. Help would be appreciated! Tyvm.

    Read the article

< Previous Page | 1 2 3 4 5 6  | Next Page >