https://admin.microsoft.com/
1. יש להיכנס לקישור הבא:
https://learn.microsoft.com/en-us/azure/active-directory/develop/howto-create-service-principal-portal#register-an-application-with-azure-ad-and-create-a-service-principal
ולבצע את סעיף
Register an application with Azure AD and create a service principal
2. יש להיכנס לקישור הבא:
https://admin.microsoft.com/Adminportal/Home#/homepage
Admin centers -> Identity -> Applications -> app registration -> All applications
לבחור את האפליקציה מהסעיף הקודם
API Permissions -> Add a permission -> Microsoft Graph -> Application permissions
להוסיף:
1. Mail.Read
2. Mail.Send
ללחוץ על Grant admin consent
------------
client secret value
כדי לחלץ אותו צריך לעשות את הפעולות הבאות
https://admin.microsoft.com/Adminportal/Home#/homepage
Admin centers -> Identity -> Applications -> app registration -> All applications
לבחור את האפליקציה מהסעיף הקודם
Certificates & secrets -> Client secrets -> New Client Secret
Description: wizenet
Expires: מירבי
לאחר מכן יופיע חלון יש להעתיק ממנו את client secret value
------------
להעביר אלינו את הפרטים הבאים
clientId
tenantId
clientSecret value
***********
יש לעלות קלאס emails
קלאס smtpSupp
את הקבצים הבאים לתיקיית BIN
mail.dll
microsoft.identitymodel.abstractions.dll
microsoft.identity.client.dll
microsoft.exchange.webservices.dll
microsoft.exchange.webservices.auth.dll
לתיקייה הראשית איפה שנמצא ה-WEB CONFIG
MailLicense.xml
מפתח בWEB CONFIG
<add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />
<add key="EmailSmtp_Type" value="365_oauth2" />
<httpRuntime maxUrlLength="10999" maxQueryStringLength="2097151" maxRequestLength="1048576" requestValidationMode="2.0" targetFramework="4.7"/>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.7">
----אחרי </system.serviceModel> ---------
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Configuration" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.1.2.0" newVersion="1.1.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Configuration.Json" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.1.2.0" newVersion="1.1.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Azure.KeyVault.Core" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.4.0" newVersion="3.0.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.InteropServices.RuntimeInformation" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Identity.Client" publicKeyToken="0a613f4dd989e8ae" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.61.0.0" newVersion="4.61.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.1" newVersion="6.0.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Kiota.Abstractions" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.8.4.0" newVersion="1.8.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.IdentityModel.Abstractions" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.5.1.0" newVersion="7.5.1.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
----
בדף הגדרת התיבה אצל המשתמש את הפרטים הבאים: (דוגמא)
SMTP SERVER: smtp.office365.com
USERNAME: help@new-ofek.co.il
PASSWORD: clientid:847ecfac-e707-4e26-b78a-58a1c5935555 tenantid:ce235945-9604-4bbe-8858-e8a7f0ed5555 clientsecret:UxJ8Q~p45tz2ZDFHrxI~P2aYFyX-xPqvogxK5555