[Ayuda] bashscript, mail con attachment
Antonio Galicia
antonio.galicia en gmail.com
Sab Nov 5 20:23:57 CST 2005
On 11/5/05, kukulcan (Quetzalcoatl P. H.) <keeper_apesta en yahoo.com> wrote:
> supongo no estoy delimitando bien los camposy esta
> tomando el attachment, y por eso dice que es muy
> grande... alguien podria darme un norte?.. envio el
> script
El problema es tu obsesión por tener todo en variables...
> #!/bin/bash
>
> from=mireccion en correo.com
> subject='Cron-Bash attachment email script'
> attachment=/home/quetzal/default.html
> emailtarget=mireccion en correo.com
> msgdate=`date +"%a, %e %Y %T %z"`
>
> boundary=GvXjxJ+pjyke8COw
cat > msg.tmp <<!
> Date: $msgdate
> From: $from
> To: $emailtarget
> Subject: $subject
> Mime-Version: 1.0
> Content-Type: multipart/mixed; boundary=$boundary
> Content-Disposition: inline
>
> --$boundary
> Content-Type: text/plain; charset=us-ascii
> Content-Disposition: inline
>
> This is the text that makes up the body of the email.
>
> Anything you want to appear in the body of the message
> should be put here. Try to keep it generic since its a
> form email. Something along the lines of,
>
> The results of xyz script has been attached to this
> email.
>
> --$boundary
> Content-Type: text/plain; charset=us-ascii
> Content-Disposition: attachment; filename=file.csv
!
#echo $daemail > msg.tmp
#echo '\' >> msg.tmp
> cat $attachment >> msg.tmp
#echo '\' >> msg.tmp
> echo --$boundary-- >> msg.tmp
#email=`cat msg.tmp`
cat msg.tmp | /usr/sbin/sendmail -t
> echo '----- para ver lo que envio a sendmail -------'
> echo $email
> rm msg.tmp
Cuando mandas algo a una variable pierdes los CR por lo que queda
como una sola línea laaaaaaaaaaaaaarga.
--
Saludos,
Toño
----
http://agc.com.mx/antoniogc/blog
_______________________________________________
Ayuda mailing list
Ayuda en linux.org.mx
Para salir de la lista: http://mail.linux.org.mx/cgi-bin/mailman/listinfo/ayuda/
Más información sobre la lista de distribución Ayuda