-2

Sending mail using .netcore 3.1 and kafka

Gülsen Keskin
  • 657
  • 7
  • 23
  • 1
    I don't get what your question has to do with Kafka. You just want to send email from a .NET app. What's stopping you? – mason Dec 21 '21 at 15:10
  • i want to send it using kafka producer and consumer – Gülsen Keskin Dec 21 '21 at 15:18
  • do you have a suggestion that I would like to do something in the structure that you see on the link @mason – Gülsen Keskin Dec 21 '21 at 15:20
  • 2
    I don't see any point in looking at the link. You want to send an email from .NET. That issue has nothing to do with Kafka. Try that out. See if you can get it working. Then if you need it to happen in the context of a Kafka consumer, then put the code there. If it doesn't work, provide a [mcve]. – mason Dec 21 '21 at 16:22
  • All right, I'll try. Thank you very much @mason – Gülsen Keskin Dec 21 '21 at 18:28

1 Answers1

1

Kafka doesn't use SMTP protocol.

If you want a producer to get data to an email client, you'd need to consume a record, then use some other library to send emails.

// TODO: create consumer
// TODO: loop over records

var consumeResult = consumer.Consume(...);

//  TODO: Define this method
sendMail(consumeResult.Message);

// TODO: handle exceptions and close consumer when done

For example - Send email using System.Net.Mail through gmail

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245