PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio â†’ WINDEV 2024 â†’ [WD22] Send email with Office 365 server
[WD22] Send email with Office 365 server
Iniciado por guest, 05,feb. 2018 11:26 - 13 respuestas
Publicado el 05,febrero 2018 - 11: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
Miembro registrado
102 mensajes
Publicado el 05,febrero 2018 - 12:47
Sammy,

how do you add the recipients?

I use an EmailSMTPSession variable instead of the EmailStartSMTPSession() function, but my parameters are the same (except for username and pw of course).

--
http://arnoldconsult.de
WinDev 21 with Oracle, WinDevMobile Android Apps and Motorola Windows CE Mobile Barcode Scanners, Python 3 with Oracle and MySQL
Publicado el 06,febrero 2018 - 10:01
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
Publicado el 06,febrero 2018 - 18:42
Hello Joris,

Thanks for your reply, i tried it but get the same error. Any other idea?
[attachment 2582 Knipsel.JPG]
Publicado el 07,febrero 2018 - 10:22
Hi Sammy,

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

Kind regards,

Joris.
Publicado el 07,febrero 2018 - 15:11
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
Publicado el 07,febrero 2018 - 16:15
Hello King,

The country is the Netherlands.
Publicado el 13,febrero 2018 - 17:02
Nobody else with problems by sending office 365 mail?
Publicado el 13,febrero 2018 - 20:25
Works fine for me. You're getting an authentication error which typically is b/ of invalid username or password
Publicado el 13,febrero 2018 - 20:29
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…. 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.
Publicado el 13,febrero 2018 - 20:47
Office 365 username (UPN) and email address are not always the same. You might want to verify in the O365 portal..
Publicado el 14,febrero 2018 - 10:05
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?
Publicado el 24,marzo 2020 - 19:48
Pour moi, c'est le EmailConfigure(emailParameterMode, 1) qui a résolu tous mes problèmes de mails via Office365 !
Merci :-)
Miembro registrado
32 mensajes
Publicado el 22,septiembre 2020 - 16:08
sde18 a écrit :
Pour moi, c'est le EmailConfigure(emailParameterMode, 1) qui a résolu tous mes problèmes de mails via Office365 !
Merci


Merci pour cette info.
J'ai galéré un moment, pour réceptionner en IMAP...
Avec ce paramètre, ça a marché direct.

--
Patrice FROELIGER
KUCHLY SAS