I am trying to write a scheduled job that will send out email with attachments after exporting a set of data from the database to a group of users. The job will be hosted on the server.

I need something that I can run on the server to send out emails. Currently, there is no mail server installed. I don't want to use SMTP because I don't want to store the password to my email account on there (I am not the only one accessing the server).

How else can I send out an email with attachment without using an SMTP account? I have seen some servers able to send out emails without a properly email address, like root@localhost or something like that. Is it possible and how can I set up something like that?

EDIT: I get this idea of sending an email without SMTP because in PHP, for instance, I can send out an email without SMTP. I can also have my own headers in the email to control how the address will look.

  • 1
    You can't authenticate without credentials and to authenticate with credentials, you have to keep them somewhere. – gronostaj Jul 14 '14 at 13:14
  • @gronostaj But in PHP or some other scripting languages, how come we can send emails without authenticating to a SMTP? – xenon Jul 14 '14 at 13:17
  • You can use sendmail. a detail blog here how to configure it: goo.gl/O1zw89 – Suresh Kamrushi Jun 22 '15 at 11:28

SMTP servers do not require authentication. Services like GMail, and my own servers, will require authentication, to send to users outside their domain. If you are sending within the intranet, it is unlikely you will require authentication.

There are minimal SMTP relay servers like SSMTP which are designed to send outgoing email without a full install. Full service servers like Exim, Postfix, and Sendmail can be configured to use a Smarthost (relay) for all outgoing mail. Usually, this would be the corporate mail server, or the ISPs relay server, neither of which is likely to require authentication. Either of these solutions would be appropriate.

Languages like PHP, Perl, and Java have packages which will connect directly to a remote SMTP server. This allows them to send email from hosts which don't have a mail server running. Normally, these would be configured to connect to a relay server as described above.

Ensure the sending address is appropriate. For something like this you may want to use an address in the form noreply@example.com. Use the client's domain in place of host. The client may prefer a different sending address. You may also want a Reply-To: address with the email address of someone who knows about the system, although that may need to be maintained over time.

|improve this answer|||||

Since your concern is listing your personal email password on the server, why not set up a 'dummy' account at Gmail or other host and enable SMTP on it. Then you can store the password to this dummy account to be used as an outgoing-only account.

|improve this answer|||||
  • I did suggest this. However, because I'm doing this for someone who is sort of our client, they said it's not too professional to use Gmail. – xenon Jul 14 '14 at 13:15
  • 2
    does your client have a professional email provider? Why not use it? – Logman Jul 14 '14 at 13:17
  • You would have to install an internal email server like hmailserver, but then forward them to external email provider which would require authentication. If you have Google Apps, you would not need authentication with a SMTP relay service... support.google.com/a/answer/176600?hl=en Another way would be to use email ALIAS using your customers email. – Logman Jul 14 '14 at 13:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.