<commit_before>using System.Net.Mail;
using System.Threading.Tasks;

namespace Riganti.Utils.Infrastructure.Services.Mailing
{
    public class SmtpClientMailSender : IMailSender
    {
        private readonly SmtpClient client;

        public SmtpClientMailSender()
        {
            client = new SmtpClient();
        }

        public SmtpClientMailSender(SmtpClient client)
        {
            this.client = client;
        }

        public async Task SendAsync(MailMessageDTO message)
        {
            using (var smtpMessage = new MailMessage())
            {
                smtpMessage.From = ConvertAddress(message.From);
                foreach (var to in message.To)
                {
                    smtpMessage.To.Add(ConvertAddress(to));
                }
                foreach (var cc in message.Cc)
                {
                    smtpMessage.CC.Add(ConvertAddress(cc));
                }
                foreach (var bcc in message.Bcc)
                {
                    smtpMessage.Bcc.Add(ConvertAddress(bcc));
                }
                foreach (var replyTo in message.ReplyTo)
                {
                    smtpMessage.ReplyToList.Add(ConvertAddress(replyTo));
                }
                smtpMessage.Subject = message.Subject;
                if (!string.IsNullOrEmpty(message.BodyHtml))
                {
                    smtpMessage.Body = message.BodyHtml;
                    smtpMessage.IsBodyHtml = true;
                }
                else
                {
                    smtpMessage.Body = message.BodyText;
                    smtpMessage.IsBodyHtml = false;
                }

                foreach (var attachment in message.Attachments)
                {<commit_msg>SmtpClient empty From address bug fixed<commit_after>using System.Net.Mail;
using System.Threading.Tasks;

namespace Riganti.Utils.Infrastructure.Services.Mailing
{
    public class SmtpClientMailSender : IMailSender
    {
        private readonly SmtpClient client;

        public SmtpClientMailSender()
        {
            client = new SmtpClient();
        }

        public SmtpClientMailSender(SmtpClient client)
        {
            this.client = client;
        }

        public async Task SendAsync(MailMessageDTO message)
        {
            using (var smtpMessage = new MailMessage())
            {
                if (message.From != null)
                {
                    smtpMessage.From = ConvertAddress(message.From);
                }
                foreach (var to in message.To)
                {
                    smtpMessage.To.Add(ConvertAddress(to));
                }
                foreach (var cc in message.Cc)
                {
                    smtpMessage.CC.Add(ConvertAddress(cc));
                }
                foreach (var bcc in message.Bcc)
                {
                    smtpMessage.Bcc.Add(ConvertAddress(bcc));
                }
                foreach (var replyTo in message.ReplyTo)
                {
                    smtpMessage.ReplyToList.Add(ConvertAddress(replyTo));
                }
                smtpMessage.Subject = message.Subject;
                if (!string.IsNullOrEmpty(message.BodyHtml))
                {
                    smtpMessage.Body = message.BodyHtml;
                    smtpMessage.IsBodyHtml = true;
                }
                else
                {
                    smtpMessage.Body = message.BodyText;
                    smtpMessage.IsBodyHtml = false;
                }

                foreach (var attachment in message.Attachments)
                {
{'fraction_non_alphanumeric': 0.07237204182718768, 'fraction_numerical': 0.0, 'mean_word_length': 1.2178157413056743, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2684161', 'n_tokens_mistral': 930, 'n_tokens_neox': 852, 'n_words': 164}