Send Mail Error

Questions and answers on how to get the most out of FFAStrans
MarcinD
Posts: 3
Joined: Wed Sep 10, 2025 9:37 am

Re: Send Mail Error

Post by MarcinD »

Hi steinar,

of course, we are using EU node for Proofpoint Secure Email Relay, with SSL enabled at port 587. And host is on Windows 10 Pro machine, version 22H2, build 19045.6456. Hope this helps.
emcodem
Posts: 1918
Joined: Wed Sep 19, 2018 8:11 am

Re: Send Mail Error

Post by emcodem »

@MarcinD
i was able to reproduce your problem with gmail but it only occured on port 587. Port 465 works. According to AI, 587 uses STARTTLS which connects insecure then upgrades the connection to secure and 465 starts with a secure connection right away. Speculation about the source of error is that the COM Object CDO.Message that is used by sendmail component is just not compatible to use TLS1.2 when using STARTTLS and there is nothing one can do about that (no registry hacks worked for me)

In short:
Port 465 worked for gmail, and also Proofpoint seems to support 465 regarding to my research.

Further information, here are working settings at least for gmail:
ffastrans_gmail_settings.jpg
ffastrans_gmail_settings.jpg (66.07 KiB) Viewed 97 times
Also, here a powershell script that replicates what ffastrans send email node does:

Code: Select all

# ==============================================================================
# CONSOLIDATED CONFIGURATION
# ==============================================================================
$EmailAddr = "emcodem_test@gmail.com"
$AppPassword = "xxxx xxxx xxxx xxxx"  # if using google, the app password is created on https://myaccount.google.com/apppasswords
$SmtpServer = "smtp.gmail.com"
$SmtpPort = 587                        # Try 587 (STARTTLS) or 465 (SSL/TLS)
# ==============================================================================

$objEmail = New-Object -ComObject "CDO.Message"
$objEmail.From     = $EmailAddr
$objEmail.To       = $EmailAddr
$objEmail.Subject  = "Consolidated CDO Debug Test"
$objEmail.Textbody = "Testing CDO.Message with consolidated variables."

$Fields = $objEmail.Configuration.Fields
$Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
$Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $SmtpServer
$Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $SmtpPort
$Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
$Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = $EmailAddr
$Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $AppPassword
$Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = $true
$Fields.Update()

try {
    Write-Host "Triggering Send to $EmailAddr via $SmtpServer..." -ForegroundColor Cyan
    $objEmail.Send()
    Write-Host "SUCCESS: Mail sent successfully!" -ForegroundColor Green
} catch {
    Write-Host "`n--- PRIMARY ERROR ---" -ForegroundColor Red
    Write-Host "HEX Code: 0x$($_.Exception.HResult.ToString("X"))"
    Write-Host "Description: $($_.Exception.Message)"

    if ($_.Exception.InnerException) {
        Write-Host "`n--- INNER EXCEPTION ---" -ForegroundColor Yellow
        Write-Host "Detail: $($_.Exception.InnerException.Message)"
    }

    Write-Host "`n--- DIAGNOSTIC HINTS ---" -ForegroundColor Cyan
    switch ($_.Exception.HResult) {
        -2147220973 { 
            Write-Host "Hint: [0x80040213] Transport failed." 
            Write-Host "Try changing `$SmtpPort to 465 in the config at the top." -ForegroundColor Yellow
        }
        -2147220975 { Write-Host "Hint: [0x80040211] Credentials rejected. Check the App Password." }
        Default { Write-Host "Hint: Check Antivirus/Firewall settings." }
    }
}
Alternative solutions to send emails is to e.g. use commandline executor and call mail sending script. (write body to text file before that)
emcodem, wrapping since 2009 you got the rhyme?
emcodem
Posts: 1918
Joined: Wed Sep 19, 2018 8:11 am

Re: Send Mail Error

Post by emcodem »

@MarcinD in case the notification was not sent
emcodem, wrapping since 2009 you got the rhyme?
MarcinD
Posts: 3
Joined: Wed Sep 10, 2025 9:37 am

Re: Send Mail Error

Post by MarcinD »

@emcodem, thank you!
Your solution works perfectly. Thank you for sharing the code also, it will help us dive deeper if need to.

Best!
emcodem
Posts: 1918
Joined: Wed Sep 19, 2018 8:11 am

Re: Send Mail Error

Post by emcodem »

Great, thanks a lot for letting us know! This sendmail component needs some overhauling... :)
emcodem, wrapping since 2009 you got the rhyme?
Post Reply