HangfireIO / HangfireIO/Hangfire

Enqueue Task SendEmail generate multiple emails

Open
#2,006 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
10.1k
Forks
1.8k
Avg merge
1h 19m
Merged PRs (30d)
1

Description

environment :
dotnet --info
SDK de .NET (que refleje cualquier global.json):
Version: 6.0.200
Commit: 4c30de7899

Entorno de tiempo de ejecución:
OS Name: debian
OS Version:
OS Platform: Linux
RID: debian-x64
Base Path: /usr/share/dotnet/sdk/6.0.200/

Code :
`public IActionResult Index()
{
Hangfire.BackgroundJob.Enqueue(() => SendMail());
return View();
}

public void SendMail()
{
using (var _message = new MailMessage())
{
_message.From = new MailAddress("user@server.net");
_message.To.Add("user@mail.cl");

_message.Subject = "Test Mail";
_message.Body = "Test Mail";
_message.IsBodyHtml = true;

using (var smtpClient = new SmtpClient("mail.server.net"))
{
smtpClient.Port = 587;
smtpClient.EnableSsl = true;
smtpClient.Credentials = new NetworkCredential("usermail", "passmail");
smtpClient.Send(_message);
Console.WriteLine("Send Test Mail");
}
}
}`

result :

more than 18 were received Email, only one execution Index

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the report with the Index action enqueueing SendMail and check whether one invocation results in multiple email deliveries. Investigate the enqueue and execution behavior around these entry points; done means a single execution sends only one email, or the cause and required configuration are clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.