2.1 KiB
| project |
|---|
| NVRam Endurance Simulation |
Email Notification
reference:: E-Mail Service - Confluence
In Azure there is no possibility to send E-Mails because the port 25 is blocked. Therefore using an AWS Simple Email Service is necessary.
Theoretically its possible to use whatever library you want. In the example above they use the MailKit library:
var sender = Configuration.GetValue("SmtpSender", "no sender configured");
var senderAddress = new MailboxAddress(sender, sender);
var receiverAddress = new MailboxAddress("vorname.nachname@vector.com");
var messageToSend = new MimeMessage
{
Sender = senderAddress,
Subject = "SMTP Test",
From = { senderAddress },
ReplyTo = { senderAddress }
};
messageToSend.Headers.Add("X-SES-CONFIGURATION-SET", "vector-cloud-services-pool-configuration-set");
messageToSend.To.Add(receiverAddress);
messageToSend.Body = new TextPart(TextFormat.Plain) { Text = "Some Content ..." };
using (var emailClient = new SmtpClient())
{
var server = Configuration.GetValue("SmtpHost", "no host configured");
var user = Configuration.GetValue("SmtpUser", "no user configured");
var password = Configuration.GetValue("SmtpPasswort", "no password configured");
var port = 465;
var ssl = true;
emailClient.Connect(server, port, ssl);
emailClient.AuthenticationMechanisms.Remove("XOAUTH2");
emailClient.Authenticate(user, password);
emailClient.Send(messageToSend);
emailClient.Disconnect(true);
}
UPDATE: in the meantime i got an answer back from Andreas Billmann. There is a library which sets an MailClient up but the application needs to send the EMails directly.
The library is contained in the vcf-libraries Repository: https://github1.vg.vector.int/pmc/vcf-libraries/tree/master/Vector.VCF.Email/src/Vector.VCF.Email
The usage can be seen here: https://github1.vg.vector.int/pmc/vcf-services-account/blob/master/src/Vector.VCF.AccountService.Api/Clients/MailClient.cs
TAC liefert beim Abrufen von allen Mitgliedern ohnehin die Email-Adressen mit.