#61 email attachments not working

closed-fixed
nobody
None
5
2012-01-17
2012-01-13
bertys
No

using latest v3.0-rc6 setting log level to 'files' results in mail errors being sent from my server.
it looks as if it's trying to send the mail to the wrong variable. here's a snippet from the email:

"I'm afraid I wasn't able to deliver your message to the following addresses.
This is a permanent error; I've given up. Sorry it didn't work out.
</home/mysql.backups/daily/mysql/daily_mysql_2012-01-13_12h09m_Friday.sql.gz>:
Recipient unknown"

I've seen the previous bug report with what looks to be the same issue, which says it was fixed in RC1.
either it isn't fixed, i'm doing something wrong, or this is a different bug.

Thanks

Discussion

1 2 3 > >> (Page 1 of 3)
  • PittaGurneyi

    PittaGurneyi - 2012-01-13

    Please give me the following information:
    CONFIG_mail_use_uuencoded_attachments=?
    If this is set to yes, please try
    mail -s "My subject" your_email_address < "content"
    If it is set to no, try
    mutt -s "My subject" your_email_address < "content"
    For some reason mail or mutt (my guess is mutt) mistake one of the files for the email address.

     
  • PittaGurneyi

    PittaGurneyi - 2012-01-13

    There is an error: Please replace < "content" with <<< "content"

     
  • PittaGurneyi

    PittaGurneyi - 2012-01-13

    If - as I assume - it's mutt, please take a look at the manpage, i.e. man mutt, and look for the syntax line, i.e.
    mutt [-nx] [-e cmd] [-F file] [-s subj] [-b addr] [-c addr] [-a file [...] --] addr|mailto_url [...] < message
    What does this look like for you?
    Operating system?
    mutt -v for the version would also be helpful.

     
  • bertys

    bertys - 2012-01-13

    syntax from 'man mutt' as follows

    SYNOPSIS
    mutt [-nRyzZ] [-e cmd] [-F file] [-m type] [-f file]

    mutt [-nx] [-e cmd] [-a file] [-F file] [-H file] [-i file] [-s subj] [-b addr]
    [-c addr] addr [...]

    mutt [-n] [-e cmd] [-F file] -p

    mutt -v[v]

    output from 'mutt -v' as follows

    System: Linux 2.6.9-89.31.1.ELsmp (i686) [using ncurses 5.4]
    Compile options:
    -DOMAIN
    -DEBUG
    -HOMESPOOL -USE_SETGID -USE_DOTLOCK -DL_STANDALONE
    +USE_FCNTL -USE_FLOCK
    +USE_POP +USE_IMAP +USE_GSS +USE_SSL +USE_SASL
    +HAVE_REGCOMP -USE_GNU_REGEX
    +HAVE_COLOR +HAVE_START_COLOR +HAVE_TYPEAHEAD +HAVE_BKGDSET
    +HAVE_CURS_SET +HAVE_META +HAVE_RESIZETERM
    +HAVE_PGP -BUFFY_SIZE -EXACT_ADDRESS -SUN_ATTACHMENT
    +ENABLE_NLS -LOCALES_HACK +HAVE_WC_FUNCS +HAVE_LANGINFO_CODESET +HAVE_LANGINFO_YESEXPR
    +HAVE_ICONV -ICONV_NONTRANS +HAVE_GETSID +HAVE_GETADDRINFO
    ISPELL="/usr/bin/ispell"
    SENDMAIL="/usr/sbin/sendmail"
    MAILPATH="/var/mail"
    PKGDATADIR="/usr/share/mutt"
    SYSCONFDIR="/etc"
    EXECSHELL="/bin/sh"
    -MIXMASTER
    To contact the developers, please mail to <mutt-dev@mutt.org>.
    To report a bug, please use the flea(1) utility.

    running on SMEServer 7.5.1 (CentOS 4.8)

    mail -s "My subject" your_email_address <<< "content"
    and
    mutt -s "My subject" your_email_address <<< "content"
    both send email fine

     
  • PittaGurneyi

    PittaGurneyi - 2012-01-13

    Please put
    set -x
    directly before (just make a new line before it)
    case "${CONFIG_mailcontent}" in line 121
    and
    set +x
    directly after
    esac in line 186.
    Then, when you run the script, it will show you how the commands are being executed. Please post the invocation of mail/mutt depending on what appears but you should replace for example your email address - nobody needs to know that. But make sure you don't remove any " " or ' '.

     
  • bertys

    bertys - 2012-01-13

    here's the output from the script after making your adjustments:

    # Checking for permissions to write to folders:
    base folder /home/e-smith/files/users/bertys/home ... exists ... ok.
    backup folder /home/e-smith/files/users/bertys/home/mysql.backups ... exists ... writable? yes. Proceeding.
    + case "${CONFIG_mailcontent}" in
    + [[ -s /home/e-smith/files/users/bertys/home/mysql.backups/ERRORS_localhost-367104000.log ]]
    + backupfiles=("${backupfiles[@]}" "$log_errfile")
    + errornote='WARNING: Error Reported - '
    ++ mktemp /home/e-smith/files/users/bertys/home/mysql.backups/tmp/mail_content.XXXXXX
    + temp=/home/e-smith/files/users/bertys/home/mysql.backups/tmp/mail_content.H17311
    ++ du -c /home/e-smith/files/users/bertys/home/mysql.backups/status/status_daily_2012-01-13_16h41m_Friday.txt.gz /home/e-smith/files/users/bertys/home/mysql.backups/daily /horde/daily_horde_2012-01-13_16h41m_Friday.sql.gz /home/e-smith/files/users/bertys/home/mysql.backups/daily/mysql/daily_mysql_2012-01-13_16h41m_Friday.sql.gz /home/e-smi th/files/users/bertys/home/mysql.backups/daily/sme7admin/daily_sme7admin_2012-01-13_16h41m_Friday.sql.gz /home/e-smith/files/users/bertys/home/mysql.backups/daily/ul2db/d aily_ul2db_2012-01-13_16h41m_Friday.sql.gz /home/e-smith/files/users/bertys/home/mysql.backups/daily/work_db/daily_work_db_2012-01-13_16h41m_Friday.sql. gz /home/e-smith/files/users/bertys/home/mysql.backups/ERRORS_localhost-367104000.log
    ++ awk 'END {print $1}'
    + attsize=620
    + (( 4000 >= 620 ))
    + [[ xno = \x\y\e\s ]]
    + mutt -s 'WARNING: Error Reported - MySQL Backup Log and SQL Files for ulserv - 2012-01-13_16h41m' -a /home/e-smith/files/users/bertys/home/mysql.backups/status/status_ daily_2012-01-13_16h41m_Friday.txt.gz /home/e-smith/files/users/bertys/home/mysql.backups/daily/horde/daily_horde_2012-01-13_16h41m_Friday.sql.gz /home/e-smith/files/user s/bertys/home/mysql.backups/daily/mysql/daily_mysql_2012-01-13_16h41m_Friday.sql.gz /home/e-smith/files/users/bertys/home/mysql.backups/daily/sme7admin/daily_sme7admin_20 12-01-13_16h41m_Friday.sql.gz /home/e-smith/files/users/bertys/home/mysql.backups/daily/ul2db/daily_ul2db_2012-01-13_16h41m_Friday.sql.gz /home/e-smith/files/users/bertys /home/mysql.backups/daily/work_db/daily_work_db_2012-01-13_16h41m_Friday.sql.gz /home/e-smith/files/users/bertys/home/mysql.backups/ERRORS_localhost-367 104000.log -- admin@work.com
    + rm /home/e-smith/files/users/bertys/home/mysql.backups/tmp/mail_content.H17311
    + set +x

     
  • PittaGurneyi

    PittaGurneyi - 2012-01-13

    Now take a look at /home/e-smith/files/users/bertys/home/mysql.backups/ERRORS_localhost-367
    104000.log please (if it is still there) and post the content.
    furthermore please try
    mutt -s "My subject" -a select_a_file_1 select_a_file_2 -- your_email_address <<< "content"
    If this fails try
    mutt -s "My subject" -a select_a_file_1 -a select_a_file_2 your_email_address <<< "content"

     
  • PittaGurneyi

    PittaGurneyi - 2012-01-13

    I guess the error log isn't there, so please make another adjustment:
    [[ -e "$log_file" ]] && rm -f "$log_file"
    [[ -e "$log_errfile" ]] && rm -f "$log_errfile"
    put a # in front of both lines. This will prevent the rm command from being executed.
    Just rerun the script and the error log will remain.

     
  • bertys

    bertys - 2012-01-13

    error log contains the following:

    du: WARNING: use --si, not -H; the meaning of the -H option will soon
    change to be the same as that of --dereference-args (-D)
    /usr/bin/find: line 1: ELF: command not found

    first part has been explained in previous bug reports, last line appeard recently, not sure why. email attach problem existed before I saw that error so i'm sure it's not related

     
  • bertys

    bertys - 2012-01-13

    as per your suggestion...

    mutt -s "My subject" -a select_a_file_1 select_a_file_2 -- your_email_address <<< "content"
    FAILS
    seems multiple attachments require their own '-a'. once I added -a before the second file it worked

     
  • PittaGurneyi

    PittaGurneyi - 2012-01-13

    Yes i guessed as much ... now we have another nonconformity ^^
    I'll take a look at it in the next few days ... for now the solution would be to replace line 139
    mutt -s "${errornote} MySQL Backup Log and SQL Files for ${CONFIG_mysql_dump_host_friendly:-$CONFIG_mysql_dump_host} - ${datetimestamp}" -a "${backupfiles[@]}" -- ${CONFIG_mail_address} < "$log_file"

    with
    temparray=()
    for j in "${backupfiles[@]}"; do temparray+=(-a "$j"); done
    mutt -s "${errornote} MySQL Backup Log and SQL Files for ${CONFIG_mysql_dump_host_friendly:-$CONFIG_mysql_dump_host} - ${datetimestamp}" "${temparray[@]}" ${CONFIG_mail_address} < "$log_file"

    Concerning the /usr/bin/find issue ... where is your find command?
    perhaps you try finding it with
    whereis find

    Hope that helps.

     
  • bertys

    bertys - 2012-01-13

    that all need to be on one line? i'm getting syntax errors

     
  • PittaGurneyi

    PittaGurneyi - 2012-01-13

    no those are separate lines ... 3 of them
    temparray...
    for j ....
    mutt ...

     
  • bertys

    bertys - 2012-01-13

    causes the following error:

    /usr/local/bin/automysqlbackup: line 141: syntax error near unexpected token `-a'
    /usr/local/bin/automysqlbackup: line 141: `for j in "${backupfiles[@]}"; do temparray+=(-a "$j"); done'

     
  • PittaGurneyi

    PittaGurneyi - 2012-01-13

    then change -a to '-a' please

     
  • PittaGurneyi

    PittaGurneyi - 2012-01-13
    • status: open --> pending
     
  • bertys

    bertys - 2012-01-13
    • status: pending --> open
     
  • bertys

    bertys - 2012-01-13

    sorry, still no go

    /usr/local/bin/automysqlbackup: line 141: syntax error near unexpected token `'-a''
    /usr/local/bin/automysqlbackup: line 141: `for j in "${backupfiles[@]}"; do temparray+=('-a' "$j"); done'

     
  • PittaGurneyi

    PittaGurneyi - 2012-01-13

    Works perfectly fine for me. Try on bash:
    arr=(); for i in a b c d; do arr+=('-a' "$i"); done; echo "${arr[@]}"
    Then if it doesn't work, please try
    arr=(); for i in a b c d; do arr=("${arr[@]}" '-a' "$i"); done; echo "${arr[@]}"

    Also I'd like the output of
    bash -version

     
  • bertys

    bertys - 2012-01-13

    [root@bertys ~]# arr=(); for i in a b c d; do arr+=('-a' "$i"); done; echo "${arr[@]}"
    -bash: syntax error near unexpected token `'-a''
    [root@bertys ~]# arr=(); for i in a b c d; do arr=("${arr[@]}" '-a' "$i"); done; echo "${arr[@]}"
    -a a -a b -a c -a d
    [root@bertys ~]# bash -version
    GNU bash, version 3.00.15(1)-release (i686-redhat-linux-gnu)
    Copyright (C) 2004 Free Software Foundation, Inc.

     
  • PittaGurneyi

    PittaGurneyi - 2012-01-13

    Wonderful ... there are still people using bash versions prior to 3.1-alpha1 ...
    Then you need to use this line:
    for j in "${backupfiles[@]}"; do temparray=("${temparray[@]}" '-a' "$j"); done

     
  • bertys

    bertys - 2012-01-13

    unfortunately i'm restricted to whatever smeserver devs include in their updates
    making that change gets it past those lines of code but fails at the next:

    /usr/local/bin/automysqlbackup: line 143: syntax error near unexpected token `elif'
    /usr/local/bin/automysqlbackup: line 143: ` elif (( ${CONFIG_mail_maxattsize} <= ${attsize} )) && [[ "x$CONFIG_mail_splitandtar" = "xyes" ]]; then'

    sorry that this is turning into such a pain

     
  • PittaGurneyi

    PittaGurneyi - 2012-01-13

    Please use pastebin and paste your modified code from line case "${CONFIG_mailcontent}" in to the closing esac line (see before).

     
  • PittaGurneyi

    PittaGurneyi - 2012-01-13

    You genius have removed the closing "fi" before the elif line ...
    So (in your paste) you have to put it between lines 21 and 22.

     
1 2 3 > >> (Page 1 of 3)

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks