Did you know ... Search Documentation:
Profile for user Jon Judge

Comments by Jon Judge

smtp_send_mail/3*Using smtp_send_mail/3 with DKIM signature verification* Re: from(+FromAddress) atomic identifies sender address (does not set From: header) Since from() does not set the header, dkim will fail within your mail server with eg: ~~~~ Jan 8 16:29:53 host opendkim[2190]: v08GTpuZ002463: can't determine message sender; accepting Jan 8 16:29:53 host sm-mta[2463]: v08GTpuZ002463: milter=opendkim, action=eoh, continue Jan 8 16:29:53 host sm-mta[2463]: v08GTpuZ002463: milter=opendkim, action=body, skip Jan 8 16:29:53 host sm-mta[2463]: v08GTpuZ002463: Milter insert (1): header: Authentication-Results: host.example.com; dkim=permerror (bad message/signature format) ~~~~ On your email client, the email message source headers will contain: ~~~~ Authentication-Results:host.example.com; dkim=permerror (bad message/signature format) ~~~~ To fix this, you need to add an extra header (last param below) which is a copy of the from() information, ~~~~ smtp_send_mail :- compose_message, [ subject('some subject'), from('Joe <joe@example.com>'), smtp('host.example.com'), auth('username'-'SuperSecretPassword'), auth_method(plain), content_type('text/html; charset=utf-8;'), security(starttls), % needed for dkim, since from() above doesn't set From: header header('From'('Joe <joe@example.com>')) ]). ~~~~ Then the email server will report a correct signature check: ~~~~ Jan 8 16:49:58 host sm-mta[2602]: v08GntQt002602: Milter insert (1): header: DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=example.com;\n\ts=201612191203; t=1483894198;\n\tbh=gwXbMF85dCqPD8lC3d6mcSAFjffFHIYVBZecFIccdX4=;\n\th=To:From:List-Unsubscribe:Reply-To:Subject:From;\n\tb=rCfD49c3Gf3FUlnko6lY/aJE9Uzp8KY73gjU5D3ebc05vsEC9xy9yZsGG0F8v1UP9\n\t SC/du993+VWqbvyRZorTp+MbKhvM4y/VA2Kg2MbIkK/YAeuhRo2zMHpMRKlz6awf2Z\n\t 3h5bo62LFFBFXMM3cN+7QeiVOQegqmup+xtRlS5M= ~~~~ Client: ~~~~ DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=example.com; s=201612191203; t=1483893267; bh=vMvc1m8dEiZTVtf4Vhr6fw94boBpQlS+alJ8NzfjjYw=; h=To:From:Reply-To:Subject:From; b=S8JZBRioLkhkHrcoX00rVaoI4nHfLK/8n3CuiHAW0Cx3vmkJDl8+NEVOsIVSnwWqK PPBBp7dVMngCoh9uPT1I4gVjJZXGdqgXjDpRg4EXq/+peyAUYI/IWMEN181rz2dE1I MSpgPu9Pdh0JOQVZsYCbYNYINQHYjXnIx808ZP0w= ~~~~