PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > comp.unix.shell > send a mail with copies only with shell
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.unix.shell Using and programming the Unix shell.

send a mail with copies only with shell

Réponse
 
LinkBack Outils de la discussion
Vieux 26/03/2008, 00h17   #1
someusernamehere
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut send a mail with copies only with shell

There is a way for send mails only with shell commands?, I mean I know
how to send with mutt -c user@copy.com -s "subject" user@foo.bar
its possibly only with sendmail or whatever send a mail with:

* a desired subject (foobar for example)
* a Carbon copy (Cc) destinator
* a shadow copy (Bc) destinator
* reading the content of a file for the body (e.g. /home/user/foo.txt)


thanks a lot
  Réponse avec citation
Vieux 26/03/2008, 00h28   #2
Glenn Jackman
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: send a mail with copies only with shell

At 2008-03-25 07:17PM, "someusernamehere" wrote:
> There is a way for send mails only with shell commands?, I mean I know
> how to send with mutt -c user@copy.com -s "subject" user@foo.bar
> its possibly only with sendmail or whatever send a mail with:
>
> * a desired subject (foobar for example)
> * a Carbon copy (Cc) destinator
> * a shadow copy (Bc) destinator
> * reading the content of a file for the body (e.g. /home/user/foo.txt)



( printf "Subject: %s\nCc: %s\nBcc: %s\n\n" "$sub" "$cc" "$bcc"
cat "$filename"
) | /usr/lib/sendmail -t -oi

--
Glenn Jackman
"You can only be young once. But you can always be immature." -- Dave Barry
  Réponse avec citation
Vieux 26/03/2008, 00h47   #3
Gary Johnson
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: send a mail with copies only with shell

someusernamehere <someusernamehere@gmail.com> wrote:
> There is a way for send mails only with shell commands?, I mean I know
> how to send with mutt -c user@copy.com -s "subject" user@foo.bar
> its possibly only with sendmail or whatever send a mail with:
>
> * a desired subject (foobar for example)
> * a Carbon copy (Cc) destinator
> * a shadow copy (Bc) destinator
> * reading the content of a file for the body (e.g. /home/user/foo.txt)


You can do this with mutt. Mutt doesn't have to be used in interactive
mode.

mutt -b user@blind.com -c user@copy.com -s "subject" user@foo.bar < /home/user/foo.txt

--
Gary Johnson
  Réponse avec citation
Vieux 26/03/2008, 00h53   #4
someusernamehere
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: send a mail with copies only with shell

On 25 mar, 17:28, Glenn Jackman <gle...@ncf.ca> wrote:
> At 2008-03-25 07:17PM, "someusernamehere" wrote:
>
> > There is a way for send mails only with shell commands?, I mean I know
> > how to send with mutt -c u...@copy.com -s "subject" u...@foo.bar
> > its possibly only with sendmail or whatever send a mail with:

>
> > * a desired subject (foobar for example)
> > * a Carbon copy (Cc) destinator
> > * a shadow copy (Bc) destinator
> > * reading the content of a file for the body (e.g. /home/user/foo.txt)

>
> ( printf "Subject: %s\nCc: %s\nBcc: %s\n\n" "$sub" "$cc" "$bcc"
> cat "$filename"
> ) | /usr/lib/sendmail -t -oi



oh, thanks it works, but the original recipent is missing how to put
them into?

P.S. I dont want to use mutt ;-)

many thanks
  Réponse avec citation
Vieux 26/03/2008, 01h00   #5
Exal de Jesus Garcia Carrillo
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: send a mail with copies only with shell

>> ( printf "Subject: %s\nCc: %s\nBcc: %s\n\n" "$sub" "$cc" "$bcc"
>> cat "$filename"
>> ) | /usr/lib/sendmail -t -oi

>
>
> oh, thanks it works, but the original recipent is missing how to put
> them into?



may be adding a $to variable and printing it's value.
  Réponse avec citation
Vieux 26/03/2008, 03h29   #6
Wayne
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: send a mail with copies only with shell

someusernamehere wrote:
> There is a way for send mails only with shell commands?, I mean I know
> how to send with mutt -c user@copy.com -s "subject" user@foo.bar
> its possibly only with sendmail or whatever send a mail with:
>
> * a desired subject (foobar for example)
> * a Carbon copy (Cc) destinator
> * a shadow copy (Bc) destinator
> * reading the content of a file for the body (e.g. /home/user/foo.txt)
>
>
> thanks a lot


mutt can be run in non-interactive mode. I usually use
mailx for this. But you can use sendmail directly as well.

With sendmail you list all recipients on the command line.
Then add whatever headers you wish (Subject:, Cc:, Date:, etc.)
followed by a blank line, and then the body of your email.

Note there is never a Bcc header; to implement BCC you just
list extra recipients on the command line. Also note
sendmail will automatically create the required "From "
and "Date:" headers. You can over-ride the "From "
header with -f<name> if you are a "trusted" user.

All other headers are optional but you probably would
want to add "To:", "Cc:", and "Subject:" headers.

sendmail user1@example.com user2 user3 user4 <<!
To: user1
Cc: user2 user 3
Subject: yada yada yada

$(cat file-with-body-of-email-content)
!

See RFC 4021 for some commonly used headers.

-Wayne
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 05h31.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,12012 seconds with 14 queries