Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Old Printer & SMTP2Graph Permissions Issue #28

@radiganmcse

Description

@radiganmcse

Got a small issue when a printer scans to email. I get this error in the SMTP2Graph logs.

{"error":"{"code":"ErrorSendAsDenied","message":"The user account which was used to submit this request does not have the right to send mail on behalf of the specified sending account., Cannot submit message."}

I have no way of changing this old printer, but in the .eml email file, I changed the "From:" field as shown below. I wrote a quick script to adjust the files every minute or so to automatically change the field. Can SMTP2Graph detect this behavior and fix it before trying to submit to Graph?

"From: [email protected] <[email protected]>" TO "From: <[email protected]>"

Powershell script:

# Get Files
$allfiles = Get-ChildItem -Path C:\ProgramData\SMTP2Graph\mailroot\queue -Filter *.eml
# Fix Files
foreach ($file in $allfiles) {
    $filecontent = Get-Content -Path $file.FullName -Raw
    $filecontent -replace 'From: [email protected] <[email protected]>','From: <[email protected]>' | Set-Content -Path $file.FullName
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions