Mailx Return Email Command

Hi,

I'm trying to use the Mailx Return Email Command with a file attachment.
If I use the file attachment by itself, it works ok. But If I add the return email command, it won't attach the file to email.

Subject, return_email_address
Send_email_address, Body, attachment, attachment_output_name

mailx -s "${subject}" -r ${return_email} ${addresses} <<EOF
${body_text}
~< ! uuencode ${attachment} ${attachment_output_name}

~.

EOF