Account inactivity reminder I wanted to know if this is the best approach for the Single Responsibility Principle.
The responsibility of this class is to remind users whose accounts are about to expire due to inactivity.


On the 30th day of inactivity, the user gets an email.
On the 45th day of inactivity, the user does not get an email; they get disabled.




public class AccountReminder
{

    private readonly IUnitOfWork _uow;
    private readonly ISendExpiringEmail _sendExpiringEmail;

    public AccountReminder(IUnitOfWork uow, ISendExpiringEmail sendExpiringEmail)
    {
        _uow = uow;
        _sendExpiringEmail = sendExpiringEmail;
    }

    public void NotifyUpcomingExpiringAccounts()
    {

        // Establish dates
        DateTime accountWarningDateTime = DateTime.Now.AddDays(-30).Date;
        DateTime expirationDateTime = DateTime.Now.AddDays(-45).Date;

        // Retrieve users whose accounts are either about to expire or have already expired
        var users = _uow.UserRepository
            .FindBy(element =&gt; (DbFunctions.TruncateTime(element.LastLoginDate) == accountWarningDateTime));

        // Send a reminder
        foreach (var user in users)
        {
            string htmlBody = "&lt;html xmlns:v=\"urn:...xmlns=\"http://www.w3.org/TR/REC-html40\" &gt;";
            htmlBody += "&lt;head&gt;&lt;meta http-equiv=...&lt;/head&gt;";
            htmlBody += "&lt;body&gt;";

            //following line for only outlook to display image
            htmlBody += "&lt;v:shape id=\&gt;...&lt;/v:shape&gt;";
            htmlBody += "&lt;table width='100%'...&lt;/table&gt;";
            htmlBody += "&lt;/body&gt;&lt;/html&gt;";

            AlternateView htmlView = AlternateView.CreateAlternateViewFromString(htmlBody, null, MediaTypeNames.Text.Html);
            AlternateView plainView = AlternateView.CreateAlternateViewFromString(htmlBody, null, "text/plain");
            LinkedResource pic1 = new LinkedResource("images/Logo.jpg", MediaTypeNames.Image.Jpeg);
            pic1.ContentId = "Logo";
            htmlView.LinkedResources.Add(pic1);

            _sendExpiringEmail.SendTo(new[] { user.Email }, "EmailSubject", htmlView, plainView);

        }

        DisableExpiringAccounts(expirationDateTime);
    }

    private void DisableExpiringAccounts(DateTime expirationDateTime)
    {
        var expiredUsers = _uow.UserRepository.FindBy(element =&gt; element.Enabled &amp;&amp; (DbFunctions.TruncateTime(element.LastLoginDate) &lt;= expirationDateTime));

        foreach (var user in expiredUsers)
        {
            user.Enabled = false;
        }

        if (expiredUsers.Count &gt; 0)
        {
            _uow.SaveChanges();
        }
    }

}
I'm going to go with no. There's at least two responsibilities in your description alone:


Determine accounts that are about to expire due to inactivity.


and


Notify users of a situation (in this case, the inactivity expiry).


And then in your code, you have a third:


Disable expired account.


I can potentially see the first and third items being in a class together. But user notifications lumped into this smells and likely should be separated.