Solved

Mail Questions

Posted on 2001-06-15
8
256 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
Comment Utility
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
Comment Utility
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
Comment Utility
Question:

Where is the local mqueue directory located? What is full path name?
0
 

Author Comment

by:andrewmchorney
Comment Utility
What is the difference between mail and mailx?
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 40

Expert Comment

by:jlevie
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Force-accepted by
Netminder
CS Moderator
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
create user in TSM 7 550
llcommand 6 75
Max number of process in Solaris 10 2 17
Unix/bash: scripted arithmetic 13 80
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
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…

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now