Giter Club home page Giter Club logo

haraka's Introduction

Haraka - a Node.js Mail Server

Tests Coverage Status

Haraka is a highly scalable node.js email server with a modular plugin architecture. Haraka can serve thousands of concurrent connections and deliver thousands of messages per second. Haraka and plugins are written in asynchronous JS and are very fast.

Haraka has very good spam protection (see plugins) and works well as a filtering MTA. It also works well as a MSA running on port 587 with auth and dkim_sign plugins enabled.

Haraka makes no attempt to be a mail store (like Exchange or Postfix/Exim/Qmail), a LDA, nor an IMAP server (like Dovecot or Courier). Haraka is typically used with such systems.

Haraka has a scalable outbound mail delivery engine built in. Mail marked as relaying (such as via an auth plugin) is automatically queued for outbound delivery.

Getting Help

Screencast

Getting started with Haraka

Why Use Haraka?

Haraka's plugin architecture provides an easily extensible MTA that complements traditional MTAs that excel at managing mail stores but do not have sufficient filtering.

The plugin system makes it easy to code new features. A typical example is providing qmail-like extended addresses to an Exchange system, whereby you could receive mail as [email protected], and yet still have it correctly routed to [email protected]. This is a few lines of code in Haraka.

Plugins are provided for running mail through SpamAssassin, validating HELO names, checking DNS Blocklists, and many others.

Installing Haraka

Haraka requires node.js to run. Install Haraka with npm:

# If the second command gives "nobody" errors, uncomment & run the next command
# npm -g config set user root
npm install -g Haraka

After installation, use the haraka binary to set up the service.

Running Haraka

First, create the service:

haraka -i /path/to/haraka_test

That creates the directory haraka_test with config and plugin directories within. It also sets the host name used by Haraka to the output of hostname.

If hostname is not correct, edit config/host_list. For example, to receive mail addressed to [email protected], add domain.com to the config/host_list file.

Finally, start Haraka using root permissions:

haraka -c /path/to/haraka_test

And it will run.

Configure Haraka

To choose which plugins run, edit config/plugins. Plugins control the overall behaviour of Haraka. By default, only messages to domains listed in config/host_list will be accepted and then delivered via the smtp-forward plugin. Configure the destination in config/smtp_forward.ini.

Read the Fine Manual

haraka -h plugins/$name

The docs detail how each plugin is configured. After editing config/plugins, restart Haraka and enjoy!

Running from git

If you are unable to use npm to install Haraka, you can run from git by following these steps:

First clone the repository:

$ git clone https://github.com/haraka/Haraka.git
$ cd Haraka

Install Haraka's node.js dependencies locally:

$ npm install

Edit config/plugins and config/smtp.ini to specify the plugins and config you want.

Finally run Haraka:

$ node haraka.js

License and Author

Haraka is MIT licensed - see the LICENSE file for details.

Haraka is a project started by Matt Sergeant, a 10 year veteran of the email and anti-spam world. Previous projects have been the project leader for SpamAssassin and a hacker on Qpsmtpd.

haraka's People

Contributors

analogic avatar arlolra avatar baudehlo avatar celesteking avatar chazomaticus avatar darkpixel avatar darksorrow avatar dependabot[bot] avatar dexus avatar eyepulp avatar fatalbanana avatar gauravaror avatar gene-hightower avatar godsflaw avatar gramakri avatar greenkeeper[bot] avatar hayesgm avatar joshuathayer avatar kingnoosh avatar lnedry avatar lpatters avatar msimerson avatar schamane avatar smfreegard avatar superman20 avatar synchro avatar tstonis avatar typingartist avatar wltsmrz avatar zllovesuki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

haraka's Issues

smtp_forward seems doesn't work with multi-recipients

I think it need a code change like this in smtp_forward.js?

                       if (recipients.length) {
                            // don't move to next state if we have more recipients
                            command="mail";
                            return;
                        }

add a line command="mail";

It's seems work fine, but I have no idea that is absolutely correct.

Error writing to closed socket

In rare cases I received the following error when sending mail:

Error: This socket is closed.
at Socket._write (net.js:451:28)
at Socket.write (net.js:444:15)
at pluggableStream.write (/usr/local/lib/node_modules/Haraka/tls_socket.js:96:34)
at pluggableStream.send_command (/usr/local/lib/node_modules/Haraka/outbound.js:728:14)
at [object Object]. (/usr/local/lib/node_modules/Haraka/outbound.js:844:36)
at [object Object].emit (events.js:88:20)
at afterRead (fs.js:1111:12)
at Object.wrapper as oncomplete

Would the correct solution be a try/catch like this:
sstur@0ffae89

Or a callback?

no qmail

Cannot find qmail-queue binary (/var/qmail/bin/qmail-queue)

451 Queuing declined or disabled

Hi there,

I am getting a "451 Queuing declined or disabled, try later" error while attempting to send an email from a user (using LOGIN) listed in auth_flat_file to another (external account).

Starting up Haraka version 0.8.0
[INFO] Loading plugins
[INFO] Loading plugin: auth/flat_file
[DEBUG] registered hook capabilities to auth/flat_file.hook_capabilities
[DEBUG] registered hook unrecognized_command to auth/flat_file.hook_unrecognized_command
[INFO] Loading plugin: rcpt_to.in_host_list
[DEBUG] registered hook rcpt to rcpt_to.in_host_list.hook_rcpt
[DEBUG] [server] running init_master hooks
[NOTICE] Listening on port 587
[INFO] [outbound] Loading outbound queue from /home/haraka_mail_server/haraka/queue

The sender validates fine:
[PROTOCOL] CDE57FCF-FC69-48F1-B6D9-EB69D86AD5D3.1 S: 250 sender OK

and so does the recipient:
[PROTOCOL] CDE57FCF-FC69-48F1-B6D9-EB69D86AD5D3.1 S: 250 recipient ok

Haraka then proceeds:
[DEBUG] CDE57FCF-FC69-48F1-B6D9-EB69D86AD5D3.1 running data hooks
[PROTOCOL] CDE57FCF-FC69-48F1-B6D9-EB69D86AD5D3.1 S: 354 go ahead, make my day
[DATA] CDE57FCF-FC69-48F1-B6D9-EB69D86AD5D3.1 C: Date: Tue, 13 Sep 2011 11:47:10 UT
...blah blah blah (message data)
...blah blah blah (message data)
...blah blah blah (message data)
[DEBUG] CDE57FCF-FC69-48F1-B6D9-EB69D86AD5D3.1 running data_post hooks
[DEBUG] CDE57FCF-FC69-48F1-B6D9-EB69D86AD5D3.1 running queue hooks
[PROTOCOL] CDE57FCF-FC69-48F1-B6D9-EB69D86AD5D3.1 S: 451 Queuing declined or disabled, try later
[PROTOCOL] CDE57FCF-FC69-48F1-B6D9-EB69D86AD5D3 C: QUIT
[DEBUG] CDE57FCF-FC69-48F1-B6D9-EB69D86AD5D3 running quit hooks
[PROTOCOL] CDE57FCF-FC69-48F1-B6D9-EB69D86AD5D3 S: 221 closing connection. Have a jolly good day.
[DEBUG] CDE57FCF-FC69-48F1-B6D9-EB69D86AD5D3 running disconnect hooks
[DEBUG] CDE57FCF-FC69-48F1-B6D9-EB69D86AD5D3 closing client

I tried the test_queue plugin and it placed the message successfully at the /tmp directory.

I am running the process whilst loged in at the root account:
root@Node11:/home/haraka_mail_server/haraka# haraka -c ./
(also tried the full path - also tried from within /root/haraka_mail_server --another test installation)

I have even CHMOD'ed the directory /home/haraka_mail_server/haraka/queue to 777, just in case...

The only plugins I am running are:
auth/flat_file
rcpt_to.in_host_list
(including regex for the recipients)

PS: If I use the plugin relay_all, the message goes out without any issues...

Any ideas? Am I missing something somewhere?

-Best regards

Crash when using outbound.send_email to reply to sender

when in a exports.hook_data_post plugin the following crash occurs when trying to reply to the sender.

[CRIT] [-] [core] TypeError: Object [object Object] has no method 'replace'
[CRIT] [-] [core] at Address.parse (/usr/lib/node_modules/Haraka/address.js:69:17)
[CRIT] [-] [core] at new Address (/usr/lib/node_modules/Haraka/address.js:21:14)
[CRIT] [-] [core] at HMailItem.try_deliver_host (/usr/lib/node_modules/Haraka/outbound.js:763:22)
[CRIT] [-] [core] at /usr/lib/node_modules/Haraka/outbound.js:730:14
[CRIT] [-] [core] at asyncCallback (dns.js:84:16)
[CRIT] [-] [core] at Object.onanswer as oncomplete

outbound.send_email works fine otherwise when sending to the original recipient

Object has no method logerror

Im getting the above error message when doing node haraka.js .
It refers to line 38 on config.js where logger.logerror is being called from logger.js

I checked logger.js and there really doesnt seem to be a logerror method defined in there?

Any help please?

To: field does not get changed in Tutorial?

Hi,

I have followed the tutorial for creating plugin. Everything went as stated in the tutorial. However when I checked the /tmp/mail.eml file, the To: field did not get changed as shown on the console.

(Haraka/1.0.1) with ESMTP id 2DD04FCA-75EB-454A-9B88-2943321D8767;
Fri, 11 Nov 2011 09:27:00 -0500
Date: Fri, 11 Nov 2011 09:27:00 -0500
To: [email protected]
From: [email protected]
Subject: test Fri, 11 Nov 2011 09:27:00 -0500
X-Mailer: swaks v20100211.0 jetmore.org/john/code/swaks/

I am curious what was changed and how does the next phase picks up the change to deliver the mail to the changed address? Thank you for your help.

2 questions

1- How to send email with Haraka???

2- I need write plugin read body, address in one plugin???

How to clear mail error ???

"That's because your previous emails from gmail returned a 4xx error, which meant that gmail would try to deliver them again later. "

How to stop ???

Bug in smtp_client.js with TLS

From a friend (should be an obvious fix):

I've been looking at Haraka, for a temporary SMTP relay for a client where we need some smarts in place. It's great, I've got a plugin working (which we'll contribute of course) but TLS is giving me a headache. I'm getting this crash at run time;

[DEBUG] [DBBAB599-45DC-4434-BFBF-6A51F10CC4E2.1] [core] running queue hooks
[DEBUG] [DBBAB599-45DC-4434-BFBF-6A51F10CC4E2.1] [core] running queue hook in queue/smtp_forward plugin
[INFO] [DBBAB599-45DC-4434-BFBF-6A51F10CC4E2.1] [queue/smtp_forward] forwarding to 209.20.84.2:25
[INFO] [-] [core] [smtp_client_pool] dispense() clients=1 available=0
[DEBUG] [-] [core] [smtp_client_pool] dispense() - creating obj - count=1
[DEBUG] [-] [core] [smtp_client_pool] E9743E74-75BF-4304-817E-705793B58DDF created
[DEBUG] [DBBAB599-45DC-4434-BFBF-6A51F10CC4E2.1] [queue/smtp_forward] Got smtp_client: E9743E74-75BF-4304-817E-705793B58DDF

[CRIT] [-] [core] ReferenceError: enable_tls is not defined

[CRIT] [-] [core] at SMTPClient. (/usr/lib/node_modules/Haraka/smtp_client.js:338:40)
[CRIT] [-] [core] at SMTPClient.emit (events.js:64:17)
[CRIT] [-] [core] at pluggableStream. (/usr/lib/node_modules/Haraka/smtp_client.js:54:18)
[CRIT] [-] [core] at pluggableStream.emit (events.js:67:17)
[CRIT] [-] [core] at pluggableStream.process_data (/usr/lib/node_modules/Haraka/line_socket.js:24:18)
[CRIT] [-] [core] at pluggableStream. (/usr/lib/node_modules/Haraka/line_socket.js:34:44)
[CRIT] [-] [core] at pluggableStream.emit (events.js:67:17)
[CRIT] [-] [core] at Socket. (/usr/lib/node_modules/Haraka/tls_socket.js:40:14)
[CRIT] [-] [core] at Socket.emit (events.js:67:17)
[CRIT] [-] [core] at TCP.onread (net.js:367:14)

When sending a test message with swak.

No ability to delete/replace headers

Because we don't parse the headers there is currently no ability to delete/replace headers. This would be used in the spamassassin plugin (among other areas) to munge the subject and delete previous X-Spam-* headers.

Critical errors in outbound.js

I am getting error in line # 891 in outbound.js

populate_bounce_message(from, recip, err, this, function (err, data_lines) {

err isn't defined.

should it be:

populate_bounce_message(from, recip, msg, this, function (err, data_lines) {

How to clear mail queue

LOG:

[PROTOCOL] 1225314E-62A8-4AFC-B41A-BAC47DE8629F S: 250 Message Queued

How to clear mail queue???

Better architecture for the SMTP Auth plugins

Hi,

i am thinking about better plugins architekture for SMTP Auth. I this it has to be splitted in two parts:

  • authentification methods
  • user credential storages

So the should be main plugins/auth.js file that has manage 3 hooks:

  • capability calculated on configured authentification methods plugins
  • handle authentification communication with the client and check user credentials
  • bind user credential storages ( flat_file, json_file, httpaccess_file, mongodb, mysql,... what ever)

What do you think about that ? I would realy like to contribute to this.

Error in outbound.js regarding the default_bounce_template

Here is the current code:
837 var bounce_msg_ = config.get('outbound.bounce_message', 'list');
838 if (bounce_msg_.length === 0) {
839 bounce_msg_ = default_bounce_template;
840 }

When I created a haraka instance there were few config files that weren't created and one of them is outbound.bounce_message. Since the code is checking for the length property I got an error.

I think either an empty file should be created in config directory or the code changed to:

837 var bounce_msg_ = config.get('outbound.bounce_message', 'list');
838 if (!bounce_msg || bounce_msg_.length === 0) {
839 bounce_msg_ = default_bounce_template;
840 }

Thanks.

Logging

Since commit '28373500cb77eece0fc51e7959b1f68997925b57' - log output to the console is much worse:

For example:

[CRIT] SyntaxError: Unexpected end of input0[ 'SyntaxError: Unexpected end of input',\n ' at Object._load_and_compile_plugin (/root/Haraka/plugins.js:161:12)',\n ' at /root/Haraka/plugins.js:121:26',\n ' at Array.map (native)',\n ' at Object.load_plugins (/root/Haraka/plugins.js:115:39)',\n ' at Object.createServer (/root/Haraka/server.js:60:13)',\n ' at Object. (/root/Haraka/haraka.js:39:8)',\n ' at Module._compile (module.js:402:26)',\n ' at Object..js (module.js:408:10)',\n ' at Module.load (module.js:334:31)',\n ' at Function._load (module.js:293:12)' ]
[CRIT] at Object._load_and_compile_plugin (/root/Haraka/plugins.js:161:12)1[ 'SyntaxError: Unexpected end of input',\n ' at Object._load_and_compile_plugin (/root/Haraka/plugins.js:161:12)',\n ' at /root/Haraka/plugins.js:121:26',\n ' at Array.map (native)',\n ' at Object.load_plugins (/root/Haraka/plugins.js:115:39)',\n ' at Object.createServer (/root/Haraka/server.js:60:13)',\n ' at Object. (/root/Haraka/haraka.js:39:8)',\n ' at Module._compile (module.js:402:26)',\n ' at Object..js (module.js:408:10)',\n ' at Module.load (module.js:334:31)',\n ' at Function._load (module.js:293:12)' ]

The intent of the previous patch was to remove carriage returns from messing up the syslog output (as syslog on Linux doesn't handle this well).

How about changing line 33 of logger.js to:

data.replace(/\r/g, '');

It should then be up to the individual log plugin as to whether to filter LF's into \n or not (syslog handled LF's without issue).

With this modification; my console log output is back to normal:

[CRIT] at Function._load (module.js:293:12)10[ 'SyntaxError: Unexpected end of input',
' at Object._load_and_compile_plugin (/root/Haraka/plugins.js:161:12)',
' at /root/Haraka/plugins.js:121:26',
' at Array.map (native)',
' at Object.load_plugins (/root/Haraka/plugins.js:115:39)',
' at Object.createServer (/root/Haraka/server.js:60:13)',
' at Object. (/root/Haraka/haraka.js:39:8)',
' at Module._compile (module.js:402:26)',
' at Object..js (module.js:408:10)',
' at Module.load (module.js:334:31)',
' at Function._load (module.js:293:12)' ]

BCC

I have just installed Haraka and intend to use it to receive incoming emails. The only change I have made is to use the test_queue plugin so that the emails are delivered to a test folder.

When I test it using to, cc and bcc fields from my email client, it receives the email into the queue fine, but there is no details of the BCC address.

I have read up a bit about SMTP and this is correct, it should strip the BCC header from the email.

But - I can't see a way of stopping this happening for use in my situation, i.e. I want to be able to see the original email, BCC header field included.

Any help would be appreciated.

cluster and nodejs 0.6.x

Cannot get the cluster function to work with nodejs 0.6.x. Apparantly cluster is now integrated within nodejs 0.6.x and the api's have changed. Is there any workaround to get it run?

Dynamic configuration

Looking for the best way to dynamically set configs based on environment. For example, executing haraka with the command NODE_ENV=dev node haraka -c smtp would set the listening port to 2525, whereas NODE_ENV=prod node haraka -c smtp would set the listening port to the default 25. Since the supported types of configs are all "flat" in some sense, there's no way to make this dynamic. What do you suggest?

Thanks,

Ralph

allow mask in data.uribl.zones

In the case of multi.uribl.com, for example allow usahe of
multi.uribl.com/2 to only query the "black" subset of the data

as per
http://www.uribl.com/about.shtml

X Binary On List

2 00000010 black
4 00000100 grey
8 00001000 red
14 00001110 black,grey,red (for testpoints)
255 11111111 your DNS is blocked from querying URIBL

Decode error line by line

Harka is poor for decode the data charset not UTF-8, and I 'm tring to decode mail with node-iconv, at last it failed beacuse harka decode the data line by line.

For exapmle:

I have a base64 encoding string with charset GB2312:

  yMvD8c34MTDUwjIwyNW15yCjqLCyufrVwqOpIL7dwLTX1MD7scjRx7XEz/vPoqOsDQrA+7HI0cfW
  tNX+tbG+1rK/ttO98czs0tG+rc3qyKu/2NbGwcu/qNT6t8a1xMDPvNLL1bb7zNijrL+o1Pq3xsG9
  zcjK3MnLuvOxu7T+srajrNLRsbvLzc350r3UuqGjIL7dwPuxyNHHtefK08yosai1wKOswPuxyNHH
  1rTV/rWxvta1xLK/ttO98czsx+Wzv7bUv6ggLi4u

If I decode the whole string, it's correct. but I decode it line by line, it faild.

Handle all mail send to domain

How to use Haraka

I need mail server can receiver all mail to @domain.com, parse address and send back to owner email

example :

i send [email protected] , mail server receiver and parse 123, save to db...

Sorry i'm bad English

Refactor library to support programatic starting of haraka

Currently the library is tightly bound to the command line.

It would be a lot better if this was properly decoupled and there was a better createServer() entry point for the haraka library.

Would you accept a patch to restructure the library to work like this? I estimate it will take me between 2-3 hours.

I would use a similar structure convention as our application server haibu.

Something like:

https://github.com/nodejitsu/haibu/blob/master/bin/haibu-server
https://github.com/nodejitsu/haibu/blob/master/lib/haibu.js

Thoughts?

Unable to use the qmail-queue plugin

I'm attempting to use the qmail-queue plugin. But it fails to compile and haraka does not start up. I have tried to install Haraka using npm as well as using the git repository.

This is the error that I get:


[INFO] [-] [core] Loading plugin: queue/qmail-queue
[CRIT] [-] [core] Compiling plugin: queue/qmail-queue failed
[CRIT] [-] [core] Error: No such module
[CRIT] [-] [core]     at queue/qmail-queue:5:26
[CRIT] [-] [core]     at Object._load_and_compile_plugin (/data/Code/github/Haraka/plugins.js:133:12)
[CRIT] [-] [core]     at /data/Code/github/Haraka/plugins.js:88:26
[CRIT] [-] [core]     at Array.map (native)
[CRIT] [-] [core]     at Object.load_plugins (/data/Code/github/Haraka/plugins.js:81:39)
[CRIT] [-] [core]     at Object.createServer (/data/Code/github/Haraka/server.js:61:13)
[CRIT] [-] [core]     at Object.<anonymous> (/data/Code/github/Haraka/haraka.js:39:8)
[CRIT] [-] [core]     at Module._compile (module.js:432:26)
[CRIT] [-] [core]     at Object..js (module.js:450:10)
[CRIT] [-] [core]     at Module.load (module.js:351:31)

Line numer 5 of queue/qmail-queue contains:

var netBinding = process.binding('net');

I am using using node v0.6.8.

inactivity_timeout misspelled

In defaults it says 'inactivity_timeout' whereas later on it is 'inactivity_time'

var defaults = {
port: 25,
listen_host: '0.0.0.0',
inactivity_timeout: 600
};

Server.createServer = function (params) {
....
var server = net.createServer(function (client) {
client.setTimeout((config_data.main.inactivity_time || 300) * 1000);
conn.createConnection(client, server);
});

smtp_forward bug

when i send mail with long lines of body text and forward with smtp_forward, it will fail with error 'timeout' sometimes.

I think it should fixed by changing code of smtp_forward.js like this:

     socket.on('drain', function() {
        self.logdebug("Drained");
        if (command === 'data') {
            send_data();
        }
    });

changing the string 'dot' to 'data'

Haraka and non-latin characters in DATA (non latin email encodings)

When I send email which contains Russian characters to Haraka (which is configured to deliver received emails), every Russian character (in Windows1251 encoding) is replaced with some strange character sequence.

I have tried to fix this problem myself, but I couldn't - it looks like the problem is with top level code which splits incoming data by lines and converts it to strings.
line_socket.js:
function setup_line_processor (self) {
var current_data = '';
self.process_data = function (data) {
current_data += data; // <---- as I understand, there the buffer is converted to string and it goes wrong
var results;
while (results = line_regexp.exec(current_data)) {
var this_line = results[1];
current_data = current_data.slice(this_line.length);
self.emit('line', this_line);
}
};

As I understand, there is no way to fix this via plugins because they receive not raw data (buffers) but strings which are converted incorrectly.
I believe that by default Haraka should transfer emails DATA exactly as it is, using buffers, without converting it to strings because it may lead to numerous bugs with different encodings. And only optionally it should parse DATA and provide access to email body or its parts for analysis or modification.
What do you think is the best way to solve this problem?

Plugin with hook_queue don't run

My plugin:

exports.hook_queue = function(next, connection) {
var to = connection.transaction.rcpt_to,
phone_number = to[0].user,
from = connection.transaction.mail_from.address(),
body = connection.transaction.body;

this.loginfo("To: " + to[0]);
this.loginfo("From: " + from);

this.loginfo("Body: " + body);

if (checkVietnamesePhone(phone_number)) {
phone_number = convertVietnamesePhone(phone_number);
this.loginfo("Got phone: " + phone_number);
//  send_sms("61060001", phone_number, "test");
next(OK, "SMS Sent");
} else {
this.loginfo("Wrong phone: " + phone_number);
next();
}

}

When i send email from gmail -> i dont see plugin run

Configure Haraka as outbound server with Auth for PHPMail 5.1

I have configured Haraka as a simple outbound smtp server with flat_file authentification. Wrote small PHP app to test sending outgoing mails with SMTP Auth. If i use Pear PHP Mail module with Sasl_Auth - everything works. It seems to use CRAM-MD5.

Wordpress, which use PHPMail 5.1 http://phpmailer.sourceforge.net dont want to send any mails.

       The SMTP debugging output is shown below:
       SMTP -> FROM SERVER:220 telestrekoza.com ESMTP Haraka 0.8.0 ready
       SMTP -> FROM SERVER: 250-Haraka says hi localhost [127.0.0.1]
       250-PIPELINING
       250-8BITMIME
       250-SIZE 500000
       250 AUTH CRAM-MD5
       SMTP -> ERROR: AUTH not accepted from server: 500 Unrecognized command
       SMTP -> FROM SERVER:250 OK
       SMTP Error: Could not authenticate.

Thats what i get as trace:

     [NOTICE] 36DAAB35-27D8-47FE-86CD-80EDBFBA6FCB got connection from: 127.0.0.1
     [DEBUG] 36DAAB35-27D8-47FE-86CD-80EDBFBA6FCB running lookup_rdns hooks
     [DEBUG] 36DAAB35-27D8-47FE-86CD-80EDBFBA6FCB running connect hooks
     [DEBUG] 36DAAB35-27D8-47FE-86CD-80EDBFBA6FCB running ehlo hooks
     [DEBUG] 36DAAB35-27D8-47FE-86CD-80EDBFBA6FCB running capabilities hooks
     [DEBUG] 36DAAB35-27D8-47FE-86CD-80EDBFBA6FCB running capabilities hook in auth/flat_file plugin
     [DEBUG] 36DAAB35-27D8-47FE-86CD-80EDBFBA6FCB running unrecognized_command hooks
     [DEBUG] 36DAAB35-27D8-47FE-86CD-80EDBFBA6FCB running unrecognized_command hook in auth/flat_file plugin

Hanaka 0.8.0 installed with npm

SMTP Forward

Hi,

Can you please provide an example of how to use the smtp_forward plugin?

Plugin errror

1- I write haraka plugin but body is undefined, how to fix it?

2- why only plugin use hook_rcpt can run??, i wrote plugin use data_hook but it don't run

exports.hook_rcpt = function(next, connection, params) {
// enable mail body parsing
connection.transaction.parse_body = 1;

var phone_number = params[0].user;
var to = connection.transaction.rcpt_to,
from = connection.transaction.mail_from.address(),
body = connection.transaction.body;

this.loginfo("To: " + to[0]);
this.loginfo("From: " + from);
//  this.loginfo("Body: " + body);
console.log(connection);
console.log(connection.transaction.data_lines);
if (checkVietnamesePhone(phone_number)) {
phone_number = convertVietnamesePhone(phone_number);
this.loginfo("Got phone: " + phone_number);
//  send_sms("61060001", phone_number, "test");
} else {
this.loginfo("Wrong phone: " + phone_number);
}
next();

}

Haraka doesn't seem to send mails.

I tried sending a mail to by gmail id from my mail client using Haraka as my outgoing smtp server. The process seemed to completed without any errors but the mail didn't reach may gmail id.

PS. Both the Haraka server and my mail client are on my local system.

TypeError: Cannot call method 'loginfo' of undefined

Has anyone else seen the following error?

pete@pete-laptop /var/www/language_gapper/haraka $ haraka -c .

node.js:195
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: Cannot call method 'loginfo' of undefined
at Object. (/home/pete/local/node/lib/node_modules/Haraka/haraka.js:10:10)
at Module._compile (module.js:420:26)
at Object..js (module.js:459:10)
at Module.load (module.js:335:31)
at Function._load (module.js:294:12)
at Module.require (module.js:341:17)
at require (module.js:352:17)
at Object. (/home/pete/local/node/lib/node_modules/Haraka/bin/haraka:339:5)
at Module._compile (module.js:420:26)
at Object..js (module.js:459:10)

To: field does not get changed in Tutorial?

Hi,

I am just trying out the tutorial to understand how to write plugins. From the tutorial the To: was changed on the console -

[INFO] [rcpt_to.lookup] Email address now: [email protected]

However when I checked in the /tmp/mail.eml file, the content says that the To: was not changed.

Fri, 11 Nov 2011 08:50:49 -0500
Date: Fri, 11 Nov 2011 08:50:49 -0500
To: [email protected]
From: [email protected]
Subject: test Fri, 11 Nov 2011 08:50:49 -0500
X-Mailer: swaks v20100211.0 jetmore.org/john/code/swaks/

This is a test mailing

I am just curious how does the mail get send in the next phase? And where was the change saved to? Thank you for your help.

Bug: recursion receive mail from self->self

Example: We have 1 smtp server (mxs.example.com)
Situation: We send mail from mxs.example.com to -> mxs.example.com

This situation Haraka recursion send self this message indefinitely!!!
What i do wrong?

My config:

# default list of plugins
max_unrecognized_commands

# block mails from known bad hosts (see config/dnsbl.zones for the DNS zones queried)
#dnsbl


# allow bad mail signatures from the config/data.signatures file.
#data.signatures

# block mail from some known bad HELOs - see config/helo.checks.ini for configuration
#helo.checks

mail_from.nobounces

# Only accept mail where the MAIL FROM domain is resolvable to an MX record
mail_from.is_resolvable

# Only accept mail for your personal list of hosts
#rcpt_to.in_host_list

relay

test_queue

connection.relaying = 1

root@mxs:~# node -v
v0.6.5

root@mxs:~# haraka -v
Haraka.js โ€” Version: 1.0.2

Email not receiver

[INFO] Loading plugins
[DEBUG] Getting config: plugins
[INFO] Loading plugin: rcpt_to.sms
[DEBUG] registered hook data to rcpt_to.sms.hook_data
[DEBUG] registered hook queue to rcpt_to.sms.hook_queue
Starting up Haraka version 0.5.5
[DEBUG] Getting config: smtp.ini
[DEBUG] Getting config: smtp.ini
[NOTICE] Listening on port 25
[DEBUG] Getting config: early_talker_delay
[NOTICE] C04CA187-7374-4808-A433-A4114818EE02 got connection from: 209.85.161.172
[DEBUG] C04CA187-7374-4808-A433-A4114818EE02 running connect hooks
[DEBUG] Getting config: smtpgreeting
[DEBUG] Getting config: me
[PROTOCOL] C04CA187-7374-4808-A433-A4114818EE02 S: 220 mewe ESMTP Haraka 0.5.5 ready
[PROTOCOL] C04CA187-7374-4808-A433-A4114818EE02 C: EHLO mail-gx0-f172.google.com
[DEBUG] C04CA187-7374-4808-A433-A4114818EE02 running ehlo hooks
[DEBUG] Getting config: databytes
[DEBUG] C04CA187-7374-4808-A433-A4114818EE02 running capabilities hooks
[PROTOCOL] C04CA187-7374-4808-A433-A4114818EE02 S: 250-Haraka says hi mail-gx0-f172.google.com [209.85.161.172]
[PROTOCOL] C04CA187-7374-4808-A433-A4114818EE02 S: 250-PIPELINING
[PROTOCOL] C04CA187-7374-4808-A433-A4114818EE02 S: 250-8BITMIME
[PROTOCOL] C04CA187-7374-4808-A433-A4114818EE02 S: 250 SIZE 500000
[PROTOCOL] C04CA187-7374-4808-A433-A4114818EE02 C: MAIL FROM:[email protected]
[DEBUG] C04CA187-7374-4808-A433-A4114818EE02.1 running mail hooks
[PROTOCOL] C04CA187-7374-4808-A433-A4114818EE02.1 S: 250 sender OK
[PROTOCOL] C04CA187-7374-4808-A433-A4114818EE02.1 C: RCPT TO:[email protected]
[DEBUG] C04CA187-7374-4808-A433-A4114818EE02.1 running rcpt hooks
[PROTOCOL] C04CA187-7374-4808-A433-A4114818EE02.1 S: 450 I cannot deliver for that user
[PROTOCOL] C04CA187-7374-4808-A433-A4114818EE02.1 C: QUIT
[DEBUG] C04CA187-7374-4808-A433-A4114818EE02.1 running quit hooks
[PROTOCOL] C04CA187-7374-4808-A433-A4114818EE02.1 S: 221 closing connection. Have a jolly good day.
[DEBUG] C04CA187-7374-4808-A433-A4114818EE02.1 running disconnect hooks
[DEBUG] C04CA187-7374-4808-A433-A4114818EE02.1 closing client
[DEBUG] Getting config: early_talker_delay
[NOTICE] C767C642-2C94-4211-8D9A-84CD6E216E99 got connection from: 209.85.213.172
[DEBUG] C767C642-2C94-4211-8D9A-84CD6E216E99 running connect hooks
[DEBUG] Getting config: smtpgreeting
[DEBUG] Getting config: me
[PROTOCOL] C767C642-2C94-4211-8D9A-84CD6E216E99 S: 220 mewe ESMTP Haraka 0.5.5 ready
[PROTOCOL] C767C642-2C94-4211-8D9A-84CD6E216E99 C: EHLO mail-yx0-f172.google.com
[DEBUG] C767C642-2C94-4211-8D9A-84CD6E216E99 running ehlo hooks
[DEBUG] Getting config: databytes
[DEBUG] C767C642-2C94-4211-8D9A-84CD6E216E99 running capabilities hooks
[PROTOCOL] C767C642-2C94-4211-8D9A-84CD6E216E99 S: 250-Haraka says hi mail-yx0-f172.google.com [209.85.213.172]
[PROTOCOL] C767C642-2C94-4211-8D9A-84CD6E216E99 S: 250-PIPELINING
[PROTOCOL] C767C642-2C94-4211-8D9A-84CD6E216E99 S: 250-8BITMIME
[PROTOCOL] C767C642-2C94-4211-8D9A-84CD6E216E99 S: 250 SIZE 500000
[PROTOCOL] C767C642-2C94-4211-8D9A-84CD6E216E99 C: MAIL FROM:[email protected]
[DEBUG] C767C642-2C94-4211-8D9A-84CD6E216E99.1 running mail hooks
[PROTOCOL] C767C642-2C94-4211-8D9A-84CD6E216E99.1 S: 250 sender OK
[PROTOCOL] C767C642-2C94-4211-8D9A-84CD6E216E99.1 C: RCPT TO:[email protected]
[DEBUG] C767C642-2C94-4211-8D9A-84CD6E216E99.1 running rcpt hooks
[PROTOCOL] C767C642-2C94-4211-8D9A-84CD6E216E99.1 S: 450 I cannot deliver for that user
[PROTOCOL] C767C642-2C94-4211-8D9A-84CD6E216E99.1 C: QUIT
[DEBUG] C767C642-2C94-4211-8D9A-84CD6E216E99.1 running quit hooks
[PROTOCOL] C767C642-2C94-4211-8D9A-84CD6E216E99.1 S: 221 closing connection. Have a jolly good day.
[DEBUG] C767C642-2C94-4211-8D9A-84CD6E216E99.1 running disconnect hooks
[DEBUG] C767C642-2C94-4211-8D9A-84CD6E216E99.1 closing client

Any likelihood of releasing to NPM?

This plugin looks interesting and there appears nothing else out there as full featured or as thought through for SMTPd type function... Was hoping that it might be released to npm soon?

Stuck in loop delivering to localhost

I've started using Haraka in production as a mail relay to listen on localhost and deliver outgoing messages for web applications (specifically a bulk mail PHP app). Haraka has been extremely performant compared to other solutions I've tried and the ability to write custom functionality using simple JS is priceless, so thanks for all your hard work on this project!

Given the quantities of outgoing mail (84k yesterday), I've run into a few issues worth mentioning (I am working on solutions in a few cases).

Particularly, I ran into an odd situation where an email address's domain had it's MX record resolving to to 127.0.0.1. Given my setup where Haraka doesn't require auth for local connections, this sent it into an endless loop of delivering to itself.

As a workaround, I'm going to either change the port to 587, or configure auth even for local connections, but I wanted to bring this up as in issue because there are situations where web apps are hard coded to deliver to localhost:25 without auth, so it might be something worth looking into.

Besides some various fixes, I've been working on a maillog plugin that logs SMTP conversations properly with timestamp to files cycled each day. I had to add a hook to outbount.js (one-liner) so I might issue a pull request before I release the plugin if that's something you would be interested in.

Cheers,
Simon

haraka -c <config> --qlist and --qstat are broken

[root@vz127 ~]# haraka -c /home/haraka --qlist

node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: Object # has no method 'init'
at Object. (/usr/lib/nodejs/Haraka/bin/haraka:312:57)
at Module._compile (module.js:432:26)
at Object..js (module.js:450:10)
at Module.load (module.js:351:31)
at Function._load (module.js:310:12)
at Array.0 (module.js:470:10)
at EventEmitter._tickCallback (node.js:192:40)

I've tried removing init() and just loading outbound.js - however this doesn't appear to work.

0.6.x does not find node_modules directory in Haraka config directory

Example:

haraka -i /home/haraka
cd /home/haraka
npm install iconv (installs iconv into /home/haraka/node_modules)
haraka -c /home/haraka
[DEBUG] [-] [core] No iconv available - install with 'npm install iconv'

Debugging a bit I find that haraka.js is correctly setting NODE_PATH to /home/haraka/node_modules but it doesn't appear to be honoured by node for some reason.

Running:
NODE_PATH=/home/haraka/node_modules haraka -c /home/haraka

Works as expected and 'iconv' is correctly found.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.