Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6093845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:36:28+00:00 2026-05-23T12:36:28+00:00

I created a small shell script which logs all of it’s input to a

  • 0

I created a small shell script which logs all of it’s input to a log file, with which I had thought I could replace the sendmail binary and thus achieve a simple way to simulate e-mail delivery without actually setting up a working sendmail.

This failed, however. For reasons I cannot understand.

I’ve looked at the PHP mail.c source and as far as I can understand (mind you, I’m not very experienced in C), PHP executes and talks directly to the binary (set in sendmail_path). But no log files are being created when I replace the sendmail binary with my script and the script replacing sendmail will always create a log file when it’s executed, regardless of if there’s input present or not.

The script itself works fine. Its’ return codes should conform to that of sendmail’s. With the difference that my script always returns 0, regardless of the input, since I’m not really interested in checking if the input is valid – just that I’m getting some.

Is it possible to achieve what I want, i.e. using a sendmail simulator?

The script source is provided below:

#!/bin/bash

LOGDIR=/tmp/sendmail-sim
NOW=$(date +%Y%m%dT%H%M)
CNT=1
FILENAME="$LOGDIR/$NOW.$CNT.log"

while [ -f $FILENAME ]; do
    CNT=$(($CNT + 1))
    FILENAME="$LOGDIR/$NOW.$CNT.log"
done

echo "$0 $*" > $FILENAME

while read BUF
do
    echo $BUF >> $FILENAME
done

exit 0

PS. My current sendmail (or actually, postfix) does receive email from PHP, but I don’t want to actually send any email or need to go digging in its’ mail queue in development.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T12:36:28+00:00Added an answer on May 23, 2026 at 12:36 pm

    The problem was User Error, as usually. So, boys and girls, don’t forget to check write permissions on all the relevant folders.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a small program which logs text data to a file on
I've created a small python script to toggle between two files I'm using for
I have created a small application which opens,reads and creates Excel files. The app
I want to globalize my application. I have created a small form which asks
I wrote a very small application, which access the Remote Power Shell of Exchanger
A researcher has created a small simulation in MATLAB and we want to make
I have created a small flash CS4 project that has a few custom components
The organization I work for has created a small flash widget that we're encouraging
I have created a few small flash widgets that stream .mp3 audio from an
Is there a way to log all exceptions happening within JVM? A system is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.