M
M
Maxim E2016-06-18 22:06:16
linux
Maxim E, 2016-06-18 22:06:16

How to make a stub for SMTP (outgoing messages)?

Good evening everyone.
To test sending emails, you need to build an SMTP stub for outgoing messages, but I don’t know which way to dig.
There is a server with exim installed, it is necessary that all letters are either put into a folder or forwarded to a local address, keeping the sender and recipient. After saving, stop sending letters, because. the boxes are test and do not belong to us.
Suggest possible solutions please.
UPD: It is necessary to accumulate all letters in one box or in a folder on the server so that later they can be viewed all.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Alexey Cheremisin, 2016-06-18
@leahch

Put ekzim in locale delivery only. All messages will only be sent to local mailboxes.
newbiedoc.sourceforge.net/networking/exim.html

D
Dmitry Shitskov, 2016-06-18
@Zarom

You didn't describe the issue in great detail. As far as I understand, the server should accept letters for sending to any address, but deliver locally. Because If you need it for testing, then the easiest option would be to take the default Exim config as a basis and, for example, make changes to the dnslookup router, specifying local_delivery as the transport.

dnslookup:
  driver = dnslookup
  domains = ! +local_domains
  transport = local_delivery
  ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
# if ipv6-enabled then instead use:
# ignore_target_hosts = <; 0.0.0.0 ; 127.0.0.0/8 ; ::1
  no_more

And comment out the remote_smtp transport just in case. In this case, the server will not be able to actually send mail. There are other ways to solve your problem, but this one, it seems to me, will require a minimum of movement.
To receive everything in one directory, tweak local_delivery so that the delivery is in the same directory, regardless of the destination:
local_delivery:
  driver = appendfile
  file = /var/mail/testmail
  delivery_date_add
  envelope_to_add
  return_path_add
# group = mail
# mode = 0660

In this case, all letters without changing the addressee will be added to the directory /var/mail/testmail

V
Vladimir Kuts, 2016-06-19
@fox_12

Is this command suitable for your needs?:

sudo python -m smtpd -n -c DebuggingServer localhost:25

A
akelsey, 2016-06-20
@akelsey

Look for a mail server with the Catchall function, the simplest and free under Win is hMailServer for example.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question