Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
11
Erster Beitrag:
vor 5 Monaten, 2 Wochen
Letzter Beitrag:
vor 5 Monaten
Beteiligte Autoren:
Sammy Broeders, Joris, Davie, iso, steve erts, kingdr, Arie

[WD22] Send email with Office 365 server

Startbeitrag von Sammy Broeders am 05.02.2018 10:26

Hello all,

I search on the forum for sending email with a Office 365 server, found some things but no solution for me. I get the fault Connection failed: recipient address not found.

I use;
EmailStartSMTPSession(UserName,EmailWw,smtp.office365.com,587,emailOptionSecuredTLS)

Anyone with a solution for me?
Thanks,

Sammy

Antworten:

Hi Sammy,

We are sending mails with office 365 smtp from WD22. This code should work :


SMTPsession is EmailSMTPSession

EmailSetTimeOut(10)

SMTPsession.ServerAddress = "smtp.office365.com"
SMTPsession.Name = "MyAdress@MyDomain.com"
SMTPsession.Password = "MyPassword"
SMTPsession.Port = 587
SMTPsession.Option = emailOptionSecuredTLS

EmailConfigure(emailParameterMode, 1) //http://faq.windev.com/15563-faq-read.awp
IF NOT EmailStartSession(SMTPsession) THEN Error("Fout bij starten email-sessie : " + ErrorInfo())



Kind regards,

joris

von Joris - am 06.02.2018 09:01
Hello Joris,

Thanks for your reply, i tried it but get the same error. Any other idea?
[attachment 2582 Knipsel.JPG]

von Sammy Broeders - am 06.02.2018 17:42
Hi Sammy,

Then I think you are not using the right credentials or TLS option.

Kind regards,

Joris.

von Joris - am 07.02.2018 09:22
Hi

Try to check it out the following links for troubleshooting to see if 587 with TLS or SSL options or something else for the relay mail sending out using smtp.office365.com.

https://blogs.technet.microsoft.com/isantp1/2014/04/11/test-smtp-relay-in-office365/

Which country you are in?

HTH

King

von kingdr - am 07.02.2018 14:11
Hello King,

The country is the Netherlands.

von Sammy Broeders - am 07.02.2018 15:15
Nobody else with problems by sending office 365 mail?

von Sammy Broeders - am 13.02.2018 16:02
Works fine for me. You're getting an authentication error which typically is b/ of invalid username or password

von steve erts - am 13.02.2018 19:25
Hi Sammy,

if you are willing to do some .NET then you could go another route by using EWS.
Using EWS you call a webservice, which comes with every Exchange server or office365, to send your emails.

You have to include this .NET assembly Microsoft.Exchange.WebServices.dll. You also need Microsoft.Exchange.WebServices.Auth.dll and Microsoft.IdentityModel.Extensions.dll in your applications directory.

There are tons of examples in C# or VB on the internet, like this one https://www.codeguru.com/csharp/csharp/cs_internet/mail/send-e-mail-using-office-365-apis-and-exchange-web-services.html

There also a great tool with basicly ALL the possible options you can use in EWS, including source, here https://github.com/dseph/EwsEditor

I did some testing creating appointment using an inhouse Exchange server - see this post http://27130.foren.mysnip.de/read.php?27131,783546,783559#msg-783559. For office365 it's basicly the same, you just need different serveraddress.

In the end, to be honoust, I ended up writing everything in C#, because things became to complex. I also needed notifications, advanced properties and so on. But for simple email sending you will get it done in Windev.

von Arie - am 13.02.2018 19:29
Office 365 username (UPN) and email address are not always the same. You might want to verify in the O365 portal..

von Davie - am 13.02.2018 19:47
i use the same code as Joris without any problems, have you tried setting up an email account in outlook/email client using your authentication parameters?

von iso - am 14.02.2018 09:05
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.