Public bug reported:

Ubuntu 24.04.3 LTS
apticron version: 1.2.8

There is currently a bug in apticron causes emails that are send to be
rejected by the mail server, instead of reaching the intended recipient,
when using bsd-mailx.

Currently, the code in the Mailx() function in apticron behaves like
this: if neither hierloom-mailx nor s-nail, it falls back to bsd-mailx.

The issue is that the code that follows (when bsd-mailx is used)
configures CUSTOM_FROM with a -a.

Instead, the code should use -r, as per the following snippet.
This is confirmed to work properly.


Here is the existing code:

    # bsd-mailx/mailutils' mailx don't do character set                         
                                                      
    # conversion, but do not support MIME either.                               
                                                      
                                                                                
                                                      
    if [ -n "$CUSTOM_FROM" ] ; then                                             
                                                      
      /usr/bin/mailx \                                                          
                                                      
        -a "MIME-Version: 1.0" \                                                
                                                      
        -a "Content-type: text/plain; charset=UTF-8" \                          
                                                      
        -a "Content-transfer-encoding: 8bit" \                                  
                                                      
        -a "From: $CUSTOM_FROM" \
        "$@" < "$MAIL_BODY_FILE"                                                
                                                      
    else                                                                        
                                                      
      /usr/bin/mailx -a "MIME-Version: 1.0" \                                   
                                                      
        -a "Content-type: text/plain; charset=UTF-8" \                          
                                                      
        -a "Content-transfer-encoding: 8bit" \                                  
                                                      
        "$@" < "$MAIL_BODY_FILE"                                                
                                                      
    fi 


And here is the fixed code:

    # bsd-mailx/mailutils' mailx don't do character set                         
                                                      
    # conversion, but do not support MIME either.                               
                                                      
                                                                                
                                                      
    if [ -n "$CUSTOM_FROM" ] ; then                                             
                                                      
      /usr/bin/mailx \                                                          
                                                      
        -a "MIME-Version: 1.0" \                                                
                                                      
        -a "Content-type: text/plain; charset=UTF-8" \                          
                                                      
        -a "Content-transfer-encoding: 8bit" \                                  
                                                      
        -r "$CUSTOM_FROM" \                                                     
                                                      
        "$@" < "$MAIL_BODY_FILE"                                                
                                                      
    else                                                                        
                                                      
      /usr/bin/mailx -a "MIME-Version: 1.0" \                                   
                                                      
        -a "Content-type: text/plain; charset=UTF-8" \                          
                                                      
        -a "Content-transfer-encoding: 8bit" \                                  
                                                      
        "$@" < "$MAIL_BODY_FILE"                                                
                                                      
    fi

** Affects: apticron (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: apticron mailx

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2122365

Title:
  Must use -r for mailx when CUSTOM_FROM is configured

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/apticron/+bug/2122365/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to