PC SOFT

GRUPOS DE DISCUSSÃO PROFISSIONAL
WINDEVWEBDEV e WINDEV Mobile

Inicio → WINDEV 2024 → [WD22] Send email with Office 365 server
[WD22] Send email with Office 365 server
Iniciado por Sammy Broeders, fev., 05 2018 11:26 AM - 13 respostas
Publicado em fevereiro, 05 2018 - 11:26 AM
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
Membro registado
102 mensagems
Popularité : +2 (2 votes)
Publicado em fevereiro, 05 2018 - 12:47 PM
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 em fevereiro, 06 2018 - 10:01 AM
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 em fevereiro, 06 2018 - 6:42 PM
Hello Joris,

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

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

Kind regards,

Joris.
Publicado em fevereiro, 07 2018 - 3:11 PM
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 em fevereiro, 07 2018 - 4:15 PM
Hello King,

The country is the Netherlands.
Publicado em fevereiro, 13 2018 - 5:02 PM
Nobody else with problems by sending office 365 mail?
Publicado em fevereiro, 13 2018 - 8:25 PM
Works fine for me. You're getting an authentication error which typically is b/ of invalid username or password
Publicado em fevereiro, 13 2018 - 8:29 PM
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 em fevereiro, 13 2018 - 8:47 PM
Office 365 username (UPN) and email address are not always the same. You might want to verify in the O365 portal..
Publicado em fevereiro, 14 2018 - 10:05 AM
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 em março, 24 2020 - 7:48 PM
Pour moi, c'est le EmailConfigure(emailParameterMode, 1) qui a résolu tous mes problèmes de mails via Office365 !
Merci :-)
Membro registado
31 mensagems
Popularité : +5 (5 votes)
Publicado em setembro, 22 2020 - 4:08 PM
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