1

I have a database (proprietary software wrapping postgres) running on a Ubuntu 20.04 VM, which comes with a python API to read and write into the database. For technical reasons, it's better to use the python API for read/write, and not direct SQL statements. Say there's only 1 table consisting of people and their birthdays:

id,name,birthday
1,sarah,21-10-2000
2,john,31-7-1998
3,elizabeth,18-3-2001
...

I'm able to use the python API + a cronjob that runs everyday to see whose birthday is upcoming in, say, 7 days. Here's the rub: the VM sits within a private corporate network, and I have the name of the mail server which is able to send but not receive, but no user or password associated with this VM (e.g. such as how devices like printers can be setup to send emails, but the printer will have no email address itself to send the email from).

I can easily find smtp setups like the one from here which work fine when tested with throwaway gmail accounts, but seem to require non-empty AuthUser and AuthPass fields. I get dead.letter appearing in the /home/<USER> when I try to do ssmtp my_email_address@company.domain.com < test_email.txt.

Fairly new to this, so I might not be using the correct vocabulary, but hopefully I've adequately described the desired behaviour.

I'm not married to ssmtp either; any other lightweight MTA will do just fine.

AndreyIto
  • 349
  • Why don't you ask for an application username/password to authenticate to the corporate mail server? If you start sending emails via Gmail, (a) this could be blocked without warning, (b) you've potentially got personal information leakage in contravention of local data protection laws – Chris Davies Feb 17 '21 at 07:37
  • 1
    Already asked for that, we're trying directly sending from mail server first. I'm not sure why they're reluctant to generate admin-user@corporate.domain.com emails; might be some security issue itself in and of itself. – AndreyIto Feb 17 '21 at 09:24
  • I believe that msmtp replaced ssmtp but either should work for you. You will need authentication to use Gmail as a relay to an external-to-Gmail address. Please don't take this as rudeness by saying "Just Google", but this search will help you identify some possible solutions for your situation – Chris Davies Feb 17 '21 at 09:31
  • Thanks for your msmtp idea, I'll look into that. However, my question was not about relaying through gmail servers using a gmail account, it was about relaying through company servers without a company email (odd, I know). I tried it out with throwaway gmails just for core functionality testing. – AndreyIto Feb 17 '21 at 22:39
  • Oh ok. I misunderstood that. If I was running these servers I would probably allow you to deliver to a local (corporate) account but not off-site. Reading man msmtp it looks like it's simply a case of not enabling authentication, and omitting the user/pass parameters. – Chris Davies Feb 17 '21 at 22:50
  • @roaima msmtp was a great idea, but after some tests unfortunately also insists on a valid email address to send from. omitting the user field results in a server message: 501 5.1.7 Invalid address error, even with auth switched off (could be that auth just disables the need for a password?) – AndreyIto Feb 18 '21 at 00:43

0 Answers0