#1 mORMot 1 » Send email with attachments » 2020-05-22 09:03:55

wesleyalves
Replies: 0

Hello Everyone, is it possible to use sendemail () to send email with attachments? if so, how to do it? Thanks

#3 mORMot 1 » THttpApiServer with SSL over windows server 2012 » 2020-04-30 12:33:33

wesleyalves
Replies: 2

Good morning everyone, I would like to thank you for this wonderful component.
I created a server using THttpApiServer. The speed and stability is incredible. Followed a turorial published on the blog and it could test the server using SSL. However, I had a problem with the server running on windows server 2012. Using the same tutorial, it was not possible to communicate with the server via HTTPS. doing some research, I managed to solve the problem with the following script that should be run by powerShell as an administrator.

Tested on Windows 10, Windows Server 2012, Windows Server 2016, and Windows Server 2019.
an observation. in Windows 2012 the certificate is valid for 12 months, for other systems, you can include additional parameters in the first line.

 -NotAfter (Get-Date).AddYears(10) -FriendlyName WjhTestCert 

I hope it is useful for someone who may experience the same problem

$cert = New-SelfSignedCertificate -DnsName *.any_name_you_want.dev,$env:COMPUTERNAME -CertStoreLocation Cert:\LocalMachine\My
$certFile = Export-Certificate -Cert $cert -FilePath C:\WjhTestCert.cer
Import-Certificate -CertStoreLocation Cert:\LocalMachine\AuthRoot -FilePath $certFile.FullName
Remove-Item $certFile.FullName
$ips = [System.Net.Dns]::GetHostAddresses("").IPAddressToString -like '*.*'
Add-Content C:\Windows\System32\drivers\etc\hosts ” $ips *.any_name_you_want.dev”
$hash = (Get-ChildItem -Path Cert:\LocalMachine\My | Where-Object {$_.Subject -match "any_name_you_want"}).Thumbprint
Add-NetIPHttpsCertBinding -IpPort "0.0.0.0:8282" -CertificateHash $hash -CertificateStoreName "My" -ApplicationId "{3F2504E0-4F89-11D3-9A0C-0305E82C3301}" -NullEncryption $false

In the version of powershell 4, the last command, which binds the certificate to the port, does not work. to get around, just bind using netsh http...

Strong hug

Board footer

Powered by FluxBB