how to specify Subject line with the sendmail command. - Unix

This is a discussion on how to specify Subject line with the sendmail command. - Unix ; Hi All, I want to send a mail from command line, I am using sendmail command for the same. I tried sending mails to myself. I am able to send mails but, i don't know how to specify Subject line. ...

+ Reply to Thread
Results 1 to 6 of 6

Thread: how to specify Subject line with the sendmail command.

  1. how to specify Subject line with the sendmail command.

    Hi All,

    I want to send a mail from command line, I am using sendmail command
    for the same.

    I tried sending mails to myself. I am able to send mails but, i don't
    know how to specify Subject line.

    I used command
    # sendmail -F "Prasad Joshi." -t prasad_joshi1@symantec.com <<< "TEST"

    This is how the header of the message looked like,
    From: Prasad Joshi.
    To: undisclosed-recipients : ;
    Subject: No Subject
    Date: Fri, 19 May 2006 13:06:03 +0530 (IST)

    How can Subject line be specified?
    How can i specify the From mail ID?
    How to specify the Subject?

    Thanks in advance.

    Thanks & regards,
    Prasad.


  2. Re: how to specify Subject line with the sendmail command.

    2006-05-19, 00:38(-07), Prasad:
    > Hi All,
    >
    > I want to send a mail from command line, I am using sendmail command
    > for the same.
    >
    > I tried sending mails to myself. I am able to send mails but, i don't
    > know how to specify Subject line.
    >
    > I used command
    > # sendmail -F "Prasad Joshi." -t prasad_joshi1@symantec.com <<< "TEST"

    [...]

    You need to provide the headers. sendmail will add some headers
    if you fail to provide them (such as Message-Id, Date...) but it
    expects that you provide the headers. sendmail is to send raw
    emails. You should consider using the mailx command instead.

    Or:

    sendmail -oi -t << EOF
    From: Prasad Joshi
    To: Prasad
    Subject: the subject

    Body of the message
    EOF

    The headers are separated from the body by an empty line.

    "-t" tells sendmail to look for the addresses to send this to in
    the To: and Cc: (and possibly Bcc: in which case it will remove
    it before sending the email) headers of the message.

    --
    Stephane

  3. Re: how to specify Subject line with the sendmail command.

    On 19 May 2006 00:38:40 -0700, Prasad wrote:
    > Hi All,
    >
    > I want to send a mail from command line,


    For mailing text, I would use
    mail -s "subject here" prasad_joshi1@symantec.com < filename_here
    or mailx -s "subject here" prasad_joshi1@symantec.com < filename_here

    if it were me.

  4. Re: how to specify Subject line with the sendmail command.

    Hi Frnd,
    I'm not an expert in Unix. But, gave a search for a solution for my query and found this.

    Please follow this:
    echo "Subject:Hi\nBody contents" | sendmail "Yourmailid"

    If it does not help, please ignore

    Thanks,
    Siva Parvathi

  5. Re: how to specify Subject line with the sendmail command.

    Send mail isn't intended at a user interface. You can type, line-for-line something like:

    send mail myemail@mycompany.com
    Subject: my repot
    This is the body of my message
    ^D

    ...Note the line that begins with "Subject:" triggers the subject line. The ^D is a control_D which signifies end-of-file.

  6. Re: how to specify Subject line with the sendmail command.

    That's too hard for me.

+ Reply to Thread