Solved

Mail Questions

Posted on 2001-06-15
8
259 Views
Last Modified: 2010-04-21
I working on a project that may in the C++ code, send a created email message through the mail command.. I have some questions.

The command format will be cat <filename>  | mail <email address>.

1. Is there a way to do a mail <address> <message>

2. Is there a way to determine that the user is a valid user?

3. Is it possible to determine if the mail command processed the request successfully and if it was not successful, how to determine what the error was.

4. Is it possible to determine if the system where the email is going received the email message?

5. Is it possible to determine if the person who is supposed to get the email actually got the email and read it.

The answers to the above question will aid in the decision regarding automatic email generation rather than doing manual email generation.

Andrew
0
Comment
Question by:andrewmchorney
  • 2
  • 2
  • 2
  • +2
8 Comments
 
LVL 40

Accepted Solution

by:
jlevie earned 100 total points
ID: 6197122
Taking the questions in order...

1) Not with any version of "mail" that I know of, but other mail clients may have that capability. However, you can always do "mail email-address <messgae-file".

2) In the general case, no. If the addresses were all local (within your domain) then it would be possible. However if the addresses are randomly distributed to Internet users there is no method(s) of verifying an address that will work in all cases.

3) The exit status of "mail email-address <message-file" will tell you if the email was accepted for delivery. That means that it has been passed from "mail" to the local Mail Transport Agent (MTA) for further processing. The MTA can only indicate any errors in delivery by sending a "bounce message" to the sender and there are a number of reasons that delivery can fail, such as: no such user at the remote server, no such domain or host, running afoul of anti-spam protection, user over quota, etc. And the bounce message won't necessarily happen immediately. If the email address looks valid (the domain exists and the remote SMTP server is in the DNS), but the remote SMTP server isn't accessible the MTA will continue delivery attempts for several days (typically 4-5 days) before giving up and "bouncing the message".

4) Maybe. If you have direct access to the local SMTP server and can check the logs you may be able to determine if specific messages have been delivered to the next hop on their path to the recipient. Note that knowing that your local SMTP server has passed the message "up the line" tells you nothing about utlimate delivery to the mail server that the adressee will get the message from. There can be one or more other MTA's in the path to the adressee.

5) The only way to determine if the recipient received and read the mail is to have some mechanism to "close the loop", like having them reply to the message or go to a web page and enter a unique value from the message. A "Return Receipt" can tell you that the email was delivered to the adressee's mail client, but you still don't know if it has been read. Also some folks (me included) disable all "Return Receipts" and in extreme cases they are blocked at the remote MTA.
0
 
LVL 5

Expert Comment

by:Nisus091197
ID: 6199065
Hi,

1. mailx -s "Subject" user@domain < standard_email

2. sendmail will certainly check that the domain that you are sending the email to is valid.  I think that it will attempt to verify the user as well.

3. The exit status of the mailx command is stored in $?.  Query this immediately after the mailx command.  It should be zero.

4. You can check the local mqueue directory to see if the email is still waiting to be forwarded, but it can stay there for up to five days.

5. I believe you can request a 'Read Receipt'.  This will prompt the user and they can choose not to.  I don't know how to do this in sendmail, but MS Exchange can do it.

Regards, Nisus
http://www.omnimodo.com
0
 

Author Comment

by:andrewmchorney
ID: 6203182
Question:

Where is the local mqueue directory located? What is full path name?
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

Author Comment

by:andrewmchorney
ID: 6203441
What is the difference between mail and mailx?
0
 
LVL 40

Expert Comment

by:jlevie
ID: 6207342
Where the mail work queue is located depends on what OS you are running. Most Unixen use /var/spool/mqueue, but the Mail Transport Agent (MTA) can be configured for a differnet location.

"mail" and "mailx" are just slightly different Mail User Agents (MUA's). Both do essentially the same thing and you typicall find one or the other on any given Unix. Dunno that I've used a Unix that had both. My recollection, hazy at best, is that "mailx" came out of the BSD world and that "mail" came from the SysV world.
0
 
LVL 5

Expert Comment

by:Nisus091197
ID: 6210442
Correct,

Under Solaris the mail queue is /var/spool/mqueue.

To find it on your system, use find:

find / -name mqueue -ls

Regards, Nisus.
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6877304
ADMINISTRATION WILL BE CONTACTING YOU SHORTLY.  Moderators Computer101 or Netminder will return to finalize these if still open in seven days.  Please post closing recommendations before that time.

Question(s) below appears to have been abandoned. Your options are:
 
1. Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you. You must tell the participants why you wish to do this, and allow for Expert response.
3. Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4. Delete the question. Again, please comment to advise the other participants why you wish to do this.

For special handling needs, please post a zero point question in the link below and include the question QID/link(s) that it regards.
http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
 
Please click the Help Desk link on the left for Member Guidelines, Member Agreement and the Question/Answer process.  http://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp

Please click you Member Profile to view your question history and keep them all current with updates as the collaboration effort continues, to track all your open and locked questions at this site.  If you are an EE Pro user, use the Power Search option to find them.  Anytime you have questions which are LOCKED with a Proposed Answer but does not serve your needs, please reject it and add comments as to why.  In addition, when you do grade the question, if the grade is less than an A, please add a comment as to why.  This helps all involved, as well as future persons who may access this item in the future to seek help.

To view your open questions, please click the following link(s) and keep them all current with updates.
http://www.experts-exchange.com/questions/Q.11438258.html
http://www.experts-exchange.com/questions/Q.20136425.html
http://www.experts-exchange.com/questions/Q.20140929.html
http://www.experts-exchange.com/questions/Q.20230446.html
http://www.experts-exchange.com/questions/Q.20252892.html
http://www.experts-exchange.com/questions/Q.20252904.html


To view your locked questions, please click the following link(s) and evaluate the proposed answer.
http://www.experts-exchange.com/questions/Q.20127150.html
http://www.experts-exchange.com/questions/Q.20141198.html

PLEASE DO NOT AWARD THE POINTS TO ME.  
 
------------>  EXPERTS:  Please leave any comments regarding your closing recommendations if this item remains inactive another seven (7) days.  Also, if you are interested in the cleanup effort, please click this link http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=commspt&qid=20274643

Moderators will finalize this question if still open in 7 days, by either moving this to the PAQ (Previously Asked Questions) at zero points, deleting it or awarding expert(s) when recommendations are made, or an independent determination can be made.  Expert input is always appreciated to determine the fair outcome.
 
Thank you everyone.
 
Moondancer
Moderator @ Experts Exchange

P.S.  For any year 2000 questions, special attention is needed to ensure the first correct response is awarded, since they are not in the comment date order, but rather in Member ID order.
0
 
LVL 5

Expert Comment

by:Netminder
ID: 6973409
Force-accepted by
Netminder
CS Moderator
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…

856 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