Manual Mail ...

Posted on 1998-10-15
Last Modified: 2010-04-20

 If I connect to the sendmail daemon(port 25) can I add headers manually?

 Lets say:
   connected to sendmail 8.8.8 ready..
   HELO myserver
   pleased to meet you myserver
   MAIL From <>
   RECPT To: <>
-> HEADER X-Name: "Here is goes: This is Header X-Name"
   begin to write and end with a dot
   closed ...
   How this HEADER X-Name: "Here is goes: This is Header X-Name" goes manually in telnet prompt at mail server port 25???
Question by:mega_tron
  • 3
LVL 51

Expert Comment

ID: 1638283
depends on the deamon/service answering on port 25, if it has a command for that you can, otherwise you only may add this as part of the DATA section.

Author Comment

ID: 1638284
soory but I know that the daemon runs on port 25. I want to know how I can enetr everything manually including the headers too. What a Mailer Agent does through its instructions included inside its binary code I want to do them manually. Can I? I know the answer is YES but I do not know HOW: comas, brackets, paranthesis etc. I should use, format of entering them etc.
 I will connect throught telnet 25

Author Comment

ID: 1638285

 Here is manually what I did:
220 ESMTP 8.8.8-970530/8.8.5/MX-980323-gjp; - Ready for food.
>>> EHLO Hello [999.999.999.999], pleased to meet you
250-SIZE 10000000
250 HELP
>>> MAIL From:<> SIZE=22
250 <>... Sender ok
>>> RCPT To:<>
250 <>... Recipient ok
>>> DATA
354 Enter mail, end with "." on a line by itself
>>> .
250 AAA10411 Message accepted for delivery Sent (AAA10411 Message accepted for delivery)
Closing connection to
>>> QUIT
221 closing connection


Accepted Solution

narzola earned 10 total points
ID: 1638286
Sendmail expects that everyline up to the first blank line in the DATA section of your message is a header.  A line beginning with white space is assumed to be an continuation of the previous header.  If you are adding custom headers, the RFC-822 convention is to prefix them with 'x-'.  Below is an example of a (very) simple mail message.

250 <>... Sender ok
250 <>... Recipient ok
354 Enter mail, end with "." on a line by itself
From: Postmaster <>
To: Postmaster <>
Subject: This is a test message


      This is a test message.

250 AAA10411 Message accepted for delivery

The important rule is to make sure that there is a blank line after the last header, but before the first line of the e-mail message.  Secondly, if you forget a 'TO:' header, Sendmail and other mail transport agents (MTAs) may add an 'Apparently-To:' header based on the 'RCPT TO:' information.

One other note -- I remember reading somewhere that MTAs are allowed to change the case of mail headers so that 'Subject:' my be transformed into 'SUBJECT:' or 'subject:'.  For a while, Sendmail would capitalize the first letter of every word in a header so that 'x-mozilla-status:' became 'X-Mozilla-Status:'.

Author Comment

ID: 1638287

 that's works... I'm giving you an A. Also thank you!

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Postfix issues with spam/auth attempts under NAT 9 112
(Open)LDAP V2.44  search proxy to AD (W2012R2) 37 179
ifconfig 4 72
Check for Linux process in script 7 49
This is the error message I got (CODE) Error caused by incompatible libmp3lame 3.98-2 with ffmpeg I've googled this error message and found out sometimes it attaches this note "can be treated with downgrade libmp3lame to version 3.97 or 3.98" …
Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question