Tuesday, July 3, 2012

Send Mail Coding using C# IN MOSS 2010


 #region Mail-Code
                                   SmtpClient mailClient = new SmtpClient();
                                   MailMessage email = new MailMessage("busadmin@kryptos.in", "chitharan.s@kryptos.in");
                                   email.Bcc.Add("vinitha.k@kryptos.in");
                                   email.Subject = "Remainder mail for Uploading Documents!!!";
                                   email.IsBodyHtml = true;
                                   email.Body = "<html><body><table><tr><td>Dear Head of the Department,</td></tr><tr><td></td></tr><tr><td>Greetings!.</td></tr><tr><td>Please find the Details below<br/></td></tr><tr><td></td></tr><tr><td> This is Message to Inform..</td> <td></td> </tr><tr><td></td></tr><tr><td></td></tr><tr><td>This weeks Douments has been Uploaded in to Sharepoint..!! </td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td>Kindly acknowledge the receipt.</td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td>Regards,</td></tr><tr><td><tr><td>Sharepoint Administrator</td></tr></table><body></html>";

                                   //Attachment attach = new Attachment(ms, inv_no + ".xls");
                                   //email.Attachments.Add(attach);
                                   // You can specify the host name or ipaddress of your server
                                   // Default in IIS will be localhost
                                   //client.PickupDirectoryLocation = @"C:\Inetpub\mailroot\Pickup\";


                                   //Default port will be 25
                                   mailClient.Port = 25;
                                   mailClient.Host = "vsr00a008-03.kryptos.gcc";
                                   mailClient.Send(email);
                                   #endregion

No comments:

Post a Comment