Hi
How to send email with attachement without saving file in a folder project
i want remove the code that saves the file
public async Task<IActionResult> SendMail([FromForm] EmailModel model) //Non invia allegato
{
var path = Path.Combine(Directory.GetCurrentDirectory(), "MyTempFolder", model.Attachement.FileName);
using (var stream = new FileStream(path, FileMode.Create))
{
await model.Attachement.CopyToAsync(stream);
}
await _emailService.SendMailAsync("address", model.Message, "title", path);
if (System.IO.File.Exists(path)) System.IO.File.Delete(path);
return Ok();
}
Now i save temporaly in MyTempFolder but i would remove that behavior
how do that?