{"id":18771519,"url":"https://github.com/anicetkeric/websendemail","last_synced_at":"2025-12-12T11:30:39.193Z","repository":{"id":114565754,"uuid":"88613687","full_name":"anicetkeric/WebSendEmail","owner":"anicetkeric","description":"send an Email using C# ","archived":false,"fork":false,"pushed_at":"2017-05-07T22:20:55.000Z","size":8569,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-29T08:11:46.099Z","etag":null,"topics":["asp-net","csharp-code","smtp"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/anicetkeric.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-04-18T10:42:14.000Z","updated_at":"2017-05-30T09:30:08.000Z","dependencies_parsed_at":"2023-03-23T01:45:38.529Z","dependency_job_id":null,"html_url":"https://github.com/anicetkeric/WebSendEmail","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anicetkeric%2FWebSendEmail","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anicetkeric%2FWebSendEmail/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anicetkeric%2FWebSendEmail/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anicetkeric%2FWebSendEmail/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anicetkeric","download_url":"https://codeload.github.com/anicetkeric/WebSendEmail/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239679406,"owners_count":19679470,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asp-net","csharp-code","smtp"],"created_at":"2024-11-07T19:25:11.860Z","updated_at":"2025-12-12T11:30:32.444Z","avatar_url":"https://github.com/anicetkeric.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WebSendEmail\nsend an Email using C# \n\n\n\n## Server Parameters\n\n| Server Name        | SMTP Address |Port  | SSL\n| ------------- |:-------------:| -----|-----|\n| Yahoo!   | smtp.mail.yahoo.com |587 |Yes |\n|Gmail      | smtp.gmail.com      |  587| Yes\n| Hotmail| smtp.live.com     |  587 | Yes\n| Outlook|smtp-mail.outlook.com      |   587 | Yes |\n\n## main class\n\n```c#\n    public class Email\n    {       \n        public string toList { get; set; }\n        public string ccList { get; set; }\n        public string subject { get; set; }\n        public string body { get; set; }\n\n    }\n\n    public class GmailSmtp\n    {\n        \n        public static int portNumber = 587;\n        public static string smtpAddress = \"smtp.gmail.com\";\n        public static bool enableSSL = true;\n        public static string sender = \"\u003cyour_email\u003e\";\n        public static string password = \"\u003cyour_password\u003e\";\n\n    }\n\n    public class YahooSmtp\n    {\n\n        public static int portNumber = 587;\n        public static string smtpAddress = \"smtp.mail.yahoo.com\";\n        public static bool enableSSL = true;\n        public static string sender = \"\u003cyour_email\u003e\";\n        public static string password = \"\u003cyour_password\u003e\";\n\n    }\n\n    public class HotmailSmtp\n    {\n\n        public static int portNumber = 587;\n        public static string smtpAddress = \"smtp.live.com\";\n        public static bool enableSSL = true;\n        public static string sender = \"\u003cyour_email\u003e\";\n        public static string password = \"\u003cyour_password\u003e\";\n\n    }\n\n    public class OutlookSmtp\n    {\n\n        public static int portNumber = 587;\n        public static string smtpAddress = \"smtp-mail.outlook.com\";\n        public static bool enableSSL = true;\n        public static string sender = \"\u003cyour_email\u003e\";\n        public static string password = \"\u003cyour_password\u003e\";\n\n    }\n}\n\n```\n\n## SendMail method with gmail smtp\nThis method use gmail.smtp\n```c#\n    public static string SendMail(Email email)\n        {\n            string from = GmailSmtp.sender;\n            MailMessage message = new MailMessage();\n            SmtpClient smtpClient = new SmtpClient();\n            string msg = string.Empty;\n            try\n            {\n                MailAddress fromAddress = new MailAddress(from);\n                message.From = fromAddress;\n                message.To.Add(email.toList);\n                if (email.ccList != null \u0026\u0026 email.ccList != string.Empty)\n                    message.CC.Add(email.ccList);\n                message.Subject = email.subject;\n                message.IsBodyHtml = true;\n                message.Body = String.Format(\"\u003chtml\u003e\u003chead\u003e\u003c/head\u003e\u003cbody\u003e\u003cdiv\u003e{0}\u003c/div\u003e\u003c/body\u003e\u003c/html\u003e\", email.body);\n                smtpClient.Host = GmailSmtp.smtpAddress;   // We use gmail as our smtp client\n                smtpClient.Port = GmailSmtp.portNumber;\n                smtpClient.EnableSsl = GmailSmtp.enableSSL;\n                smtpClient.UseDefaultCredentials = true;\n                smtpClient.Credentials = new System.Net.NetworkCredential(GmailSmtp.sender, GmailSmtp.password);\n\n                smtpClient.Send(message);\n\n                msg = \"1\";\n            }\n            catch (Exception ex)\n            {\n                msg = ex.Message;\n            }\n            return msg;\n        }\n    }\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanicetkeric%2Fwebsendemail","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanicetkeric%2Fwebsendemail","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanicetkeric%2Fwebsendemail/lists"}