Email job not working

So i have a job for sending bulk emails.

And they have to be sent at a time in the future. Which made me choose hangfire as the best option for this task.

The problem i am having is:

If i pass the method that sends the email to hangfire, the email doesn’t get sent.
But if i call the method just above the hangfire code (to rule out any issues with that method) the emails are sent but the hangfire job doesn’t send these emails.
I can see the Hangfire job moving from scheduled, to succeeded but the emails don’t get sent.

Is there something i am failing to understand when it comes to background jobs and email sending?

Please add the source code you use for the following sentenses.

You can add highlighted source code by embracing it with so-called code fences:

<source code>

Thank you for your reply:

// Create Email job
HangfireCampaignMailManager hfcm = new HangfireCampaignMailManager();
clscampaigns_email campemail = new clscampaigns_email();
campemail.LoadByCampaign(; // campaign data

// Create Send Email Scheduled Job
hfcm.sendmail(; // the method that sends the email without hangfire
campemail.jobid = BackgroundJob.Schedule(() => hfcm.sendmail(, hfcm.exactDate(campemail.deploymentdate));

@emmanuel, what hfcm.sendmail looks like? Can you show it to me?

Hi Odinserj,

Sorry i had to rush off to other commitments but i finally found a solution to the problem,

Inside - hfcm.sendmail there was a line calling a method which had the following line:


Which caused an exception when the job fired and i replaced it with


And everything has been working fine since,

Thank you very much for your help.