Hello
I had to reinstall my server and now the provider dont let me send e-mails with the old VO Class now.
Does somebody use relayserver with x# ? and has a code to share ?
Horst
Smtp relay server
Re: Smtp relay server
Hi Horst,
the issue is not the code to use a relayserver - that is easy. You have to have a mail server to use (and this cannot be GMail anymore).
Or do you need code to use SMTPS?
Wolfgang
the issue is not the code to use a relayserver - that is easy. You have to have a mail server to use (and this cannot be GMail anymore).
Or do you need code to use SMTPS?
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Re: Smtp relay server
Hello Wolfgang
This Code i found and you think its not enough to send mails ? You think i have to intstall a mailserver on my webserver ?
I found no text that says i have to install a mailserver.
This Code i found and you think its not enough to send mails ? You think i have to intstall a mailserver on my webserver ?
I found no text that says i have to install a mailserver.
Code: Select all
Schritte zum Versenden einer E-Mail über einen SMTP-Relay-Server in C#:
Namespaces importieren: Stellen Sie sicher, dass Sie die notwendigen Namespaces importieren, um E-Mails zu senden:
csharp
using System.Net.Mail;
using System.Net;
MailMessage-Objekt erstellen: Erstellen Sie ein MailMessage-Objekt und füllen Sie die Felder für Absender, Empfänger, Betreff und Körper aus.
csharp
MailMessage NetMail = new MailMessage();
NetMail.From = new MailAddress("ihreadresse@beispiel.com");
NetMail.To.Add(new MailAddress("empfaenger@beispiel.com"));
NetMail.Subject = "Betreff Ihrer E-Mail";
NetMail.Body = "Dies ist der Inhalt Ihrer E-Mail.";
NetMail.IsBodyHtml = false; // Setzen Sie dies auf true, wenn Sie HTML-E-Mails senden möchten
SmtpClient-Objekt erstellen und konfigurieren: Erstellen Sie ein SmtpClient-Objekt und konfigurieren Sie es mit den Details Ihres Relay-Servers.
csharp
SmtpClient MailClient = new SmtpClient();
// Ersetzen Sie diese Werte durch die Ihres SMTP-Relay-Dienstes (z.B. SendGrid, Mail.de, Gmail)
MailClient.Host = "smtp.ihre-relay-adresse.com"; // Hostname des SMTP-Relay-Servers
MailClient.Port = 587; // Standard-Port, kann je nach Server variieren
// Anmeldeinformationen für die Authentifizierung am SMTP-Server
MailClient.Credentials = new NetworkCredential("ihr-benutzername", "ihr-passwort");
// Aktivieren der SSL/TLS-Verschlüsselung, falls vom Server gefordert
MailClient.EnableSsl = true;
// Methode für die Zustellung der E-Mail (Network ist der Standard)
MailClient.DeliveryMethod = SmtpDeliveryMethod.Network;
E-Mail senden: Verwenden Sie die Send()-Methode des SmtpClient, um die E-Mail zu versenden.
csharp
MailClient.Send(NetMail);
Ressourcen freigeben: Es ist eine gute Praxis, die erstellten Objekte freizugeben, um Ressourcen freizugeben.
csharp
NetMail.Dispose();
MailClient.Dispose();
Re: Smtp relay server
Hi Horst,
I would strongly discourage to use a mailserver on your webserver - maintaining a mailserver is a job on his own.
You cannot simply send mails with any sender address - you have to implement a least SPF for every domain you are using as sender address.
Your provider should offer also email send services and give you an authenticated SMTP access, and with .NET it is easy to send SMTP over SSL, but even in this case the mail server of the provider must be allowed to send mails for every domain you are using as sender domain.
Wolfgang
P.S. for a project of my wife I'm maintaining a sending only mail server that sends out many thousands of mails per day - so I know a bit about the pitfalls
I would strongly discourage to use a mailserver on your webserver - maintaining a mailserver is a job on his own.
You cannot simply send mails with any sender address - you have to implement a least SPF for every domain you are using as sender address.
Your provider should offer also email send services and give you an authenticated SMTP access, and with .NET it is easy to send SMTP over SSL, but even in this case the mail server of the provider must be allowed to send mails for every domain you are using as sender domain.
Wolfgang
P.S. for a project of my wife I'm maintaining a sending only mail server that sends out many thousands of mails per day - so I know a bit about the pitfalls
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Re: Smtp relay server
hi,
https://www.mailgun.com/ could be an option. It's a dedicated smtp service for transactional email.
https://www.mailgun.com/ could be an option. It's a dedicated smtp service for transactional email.
Re: Smtp relay server
Hi Volkmar and Wolfgang
Volkmar: i dont like to be depend on a service, this can change one day and i have to run. in the worst case i will try this.
Wolfgang: i asked my provider and they told me i have to install a mailserver. i will not do that. So now i try to install SSL on the server and then i try to send mails again. A sample how to do sent mails with ssl wound be very helpfull.
Horst
ps: i am missing a xsharp libary with different function/classes from different people like you found it when clipper rules the xbase world.
Volkmar: i dont like to be depend on a service, this can change one day and i have to run. in the worst case i will try this.
Wolfgang: i asked my provider and they told me i have to install a mailserver. i will not do that. So now i try to install SSL on the server and then i try to send mails again. A sample how to do sent mails with ssl wound be very helpfull.
Horst
ps: i am missing a xsharp libary with different function/classes from different people like you found it when clipper rules the xbase world.
Re: Smtp relay server
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Re: Smtp relay server
Thanks. But
do you have the viaef/prg ?
Re: Smtp relay server
Hi Horst,
sorry, with the redesign of our website a lot of things were lost.
This here is a COM library to be used from VO, and it contains also the source code:
https://www.riedmann.it/download/SendMailCOM.zip
Wolfgang
sorry, with the redesign of our website a lot of things were lost.
This here is a COM library to be used from VO, and it contains also the source code:
https://www.riedmann.it/download/SendMailCOM.zip
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Re: Smtp relay server
Hi Wolfgang
Sorry, i know your very busy, but i was looking into the zip. And i think i made a misstake when i said viaef, because i cant import it to xide. Think viaef is vulcan ?
Horst
Sorry, i know your very busy, but i was looking into the zip. And i think i made a misstake when i said viaef, because i cant import it to xide. Think viaef is vulcan ?
Horst

