<![CDATA[Latest posts for the topic "Xin hỏi về code send mail?"]]> /hvaonline/posts/list/31.html JForum - http://www.jforum.net Xin hỏi về code send mail? /hvaonline/posts/list/41839.html#260837 /hvaonline/posts/list/41839.html#260837 GMT Xin hỏi về code send mail? /hvaonline/posts/list/41839.html#260863 /hvaonline/posts/list/41839.html#260863 GMT Xin hỏi về code send mail? Code:
public void SendEmail(string subject, string body)
        {
            var fromAddress = new MailAddress("username@gmail", "From Name");
            var toAddress = new MailAddress("Receiver@abc.xyz", "To Name");
            const string fromPassword = "Password";


            var smtp = new SmtpClient
            {
                Host = "smtp.gmail.com", // cái này sử dụng cho gmail ... thay server khác nếu muốn
                Port = 587,
                EnableSsl = true,
                DeliveryMethod = SmtpDeliveryMethod.Network,
                Credentials = new NetworkCredential(fromAddress.Address, fromPassword),
                Timeout = 200000
            };
            using (var message = new System.Net.Mail.MailMessage(fromAddress, toAddress)
            {
                Subject = subject,
                Body = body
            })
            {
                smtp.Send(message);
            }
        }
]]>
/hvaonline/posts/list/41839.html#262538 /hvaonline/posts/list/41839.html#262538 GMT
Xin hỏi về code send mail? /hvaonline/posts/list/41839.html#262564 /hvaonline/posts/list/41839.html#262564 GMT Xin hỏi về code send mail? /hvaonline/posts/list/41839.html#262869 /hvaonline/posts/list/41839.html#262869 GMT Xin hỏi về code send mail? /hvaonline/posts/list/41839.html#263019 /hvaonline/posts/list/41839.html#263019 GMT