From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <98107932924134.tru64-unix-managers.marc@archive.invalid> From: "Riggs, Joan" Date: Fri, 02 Feb 2001 02:00:18 +0000 To: tru64-unix-managers Subject: SUMMARY: sendmail errors - where do they go? - UPDATED QUERY X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=98107932924134 Thanks to the following for the zippy replies: Steve VanDevender Michael Bucholtz Clegg, Larry Roberto Mackun Ian Mortimer Jerry Berkman Lyndon Handy Kurt Ludwig Dr. Thomas P. Blinn ashok Ernest Gronblom Tim Hespe Steve VanDevender Jim Belonis ...and the anonymous "system administration account" Basically, the log is at: /usr/var/adm/syslog.dated/mail.log BUT it does not contain the info I need. The error would get logged on the NT side, as the Unix box would not be able to validate the email address for an Exchange user. The original post follows these great answers: I believe a message will be returned to you from either your mailserver if it can resolve the user's domain, or the user's mailserver if the user name doesn't exist. ----- once the mail has left for a mail hub, why would the unix machine care about any errors after its left its hands..... the exchange machine is what is supposed to realize that there are no such users and return the mail to the sender.. kinda like you post a letter to a wrong address, how are you supposed to know that it didn't reach its destination. ----- The error will show up in the text-mode communication that local sendmail does with the remote smtp server's sendmail daemon. I.e. your mailx program writes some spool files in /var/spool/mqueue and hands them off to sendmail to deliver. Sendmail attempts to deliver off in the background, so you can not receive any info from the delivery attempt. If it fails, it should write a log entry to the syslog system which on Tru64 Unix by default would be /var/adm/syslog.dated/current/mail.log Then some time later (15 minutes or 1 hour depending on the operating system and/or how sendmail daemon is configured) the sendmail daemon will retry. Then a day or 3 later (again depending on configuration) sendmail will give up and bounce the message back to the sender, with detailed information about what the remote sendmail daemon claimed the problem was. You can configure things so the retrying never happens if you want the sender notified quicker. Or you can make your script do some interaction with the remote smtp server telnet 25 vrfy
quit to verify the 'to' address separately from sending the message) ----- The next question is what you need the status for. If you can cope with the error being returned asynchronously via a bounce message from the remote system then it is possible to use that. For example, you could use procmail to detect those bounces so that you could remove users from a subscription list or otherwise do cleanup for those invalid email addresses. ----- I think the messages are logged in (on our system at least!): /usr/var/adm/syslog.dated/dd-Mmm-hh:mm/mail.log where dd-Mmm-hh:mm is I guess whenever syslog starts up new files. This may be determined in /etc/syslog.conf but I'm not sure. ----- mailx will hand the message to sendmail for delivery. The most reliable diagnostic you will get if the mail was sent to an invalid user is a bounce message that will be returned to the sender of the message (probably whoever invoked mailx). It is not possible for mailx itself to determine whether any remote user is valid at the time the message is submitted to mailx. sendmail _may_, under some circumstances, be able to determine at the time the mail is submitted to a remote system whether the remote address is valid, but that depends on the remote server signaling that during the SMTP session, which is not a requirement. ----- You may be able to do some preprocessing on your email address before you pass it to mailx. This could possibly reduce the number of errors you get. You can at the very least determine if the host portion of the address is valid and resolves. If you are using perl there is a module: "Email::Valid - Check validity of Internet email addresses". As the manpage says however: "Please note that there is no way to determine whether an address is deliverable without attempting delivery (for details, see perlfaq 9). " If you are using some kind of shell script you can still use nslookup to see if an "mx" record or maybe an "a" record exists for the host. ----- The message will go to the NT server and bounce back, probably to the sender or to 'postmaster' as is set up in the aliases. ----- Look at the smtpd (sendmail) reference page as well; it may have some log that you can examine. I'm not sure mailx will do that, but look at the reference page and in particular this option: verbose Runs mailx in verbose mode; the actual delivery of messages is displayed on the user's terminal. Same as using the -v option on the command line. Might do what you need. Or use telnet to talk to the mail agent and try to feed it the addresses for validation; I believe there is an smpt way to do that.. I may not have been clear about my reference to telnet; you can use telnet as a general purpose utility to talk to a random port on some other system and post text messages to it and see the results coming back. Coupled with, say, expect, you could craft up a program that would ask the remote mail server if it's willing to accept mail for some specific address. Of course, that doesn't mean the mail will get delivered if the remote server isn't the ultimate destination. The "chat" between your sendmail and the remote smtpd is documented in some Internet RFC, it's just a bunch of text messages. ----- Try anyway. telnet to port 25 isn't the same as telnet to port 23... If your mail server is accepting SMTP connections from you, you'll find that telnet server.name.or.ip.address 25 will get you somewhere really relevant. The subsequent exchange could look somewhat like: Connected to atlas. Escape character is '^]'. 220 atlas.astro.su.se ESMTP Sendmail 8.9.3/8.9.3; Fri, 2 Feb 2001 00:08:12 +0100 (MET) HELO as 250 atlas.astro.su.se Hello as [130.237.166.29], pleased to meet you MAIL FROM: 250 ... Sender ok RCPT TO: 550 ... User unknown QUIT 221 atlas.astro.su.se closing connection Connection closed by foreign host. (The HELO, MAIL, RCPT and QUIT lines are my input, the 3-digit ones the server's responses, the rest is verbiage from the telnet client.) ----- If the Exchange Server bounces the email back to the Tru64 box couldn't your script look at the return mail and scan for the "unknown address" (or whatever the phrase is) line and respond accordingly? ----- Depends on how the mail server is configured. You can test by telnetting to port 25 of the mail server and typing HELO, MAIL and RCPT commands by hand. In the RCPT command, try various kinds of invalid address, and see which ones result in an immediate 5xx error response. ----- Since the NT Exchange Server is the relay point the mail won't know it has an invalid address until the Exchange Server attempts to relay it. The Tru64 system isn't validating the target address - it just knows it is not for the local system and hands it off to the relay server - Exchange in your case. ----- You can try: mailx -v ... and see if that includes an error message if the user doesn't exist. If so, route the output to a file and scan it after the mailx is done. ----- Normally, a notification will be sent to the envelope sender address of the original message. If that notification bounces for any reason (e.g., bad address or mailbox full) it will end up in some postmaster mailbox. If that also fails, it will probably be dropped (although with such gross misconfiguration, all bets are off...) Some information may also be logged through syslog mechanisms. Details depend on the contents of /etc/syslog.conf, but on Tru64 UNIX you should have a look at /var/adm/syslog.dated/*/mail.log . ----- The sendmail errors are usually returned to the recipient or sent to root's inbox by MAILER-DAEMON indicating the error with the original delivery. You can also trace the error in the delivery when using the "-v" option for the Mail utility. ----- With the standard syslog setup they will go to: /var/adm/syslog.dated/current/mail.log ----- If you have email setup correctly and your mail relay host is setup correctly then the email should bounce back to the account which sent it just like it would on any other email system. ----- -----Original Message----- From: Riggs, Joan [mailto:JRiggs@kls.usaka.smdc.army.mil] Sent: Friday, February 02, 2001 11:00 AM To: 'tru64-unix-managers@ornl.gov' Cc: 'Michael Bucholtz'; 'Ian Mortimer'; 'Mackun, Roberto' Subject: sendmail errors - where do they go? - UPDATED QUERY Sorry for the too-general query - Here is a better explanation of what I am trying to do: I have a script that executes mailx on a Tru64 4.0f system, sending email to an NT exchange server. I need to be able to identify whenever this script attempts, and fails, to send a message to a user due to an invalid email address. Is this possible or will the error not show up until it gets over to the NT mail server? Thanks again. Joan Riggs Raytheon RSE / KLS Information Technology 805.355.9877 joan.riggs@kls.usaka.smdc.army.mil