chore: Add INCOMING_EMAIL_DOMAIN to host_list configuration

This code change adds the INCOMING_EMAIL_DOMAIN variable to the host_list configuration in the Haraka init.sh script. This ensures that incoming emails from the specified domain are accepted by the Haraka application. The INCOMING_EMAIL_DOMAIN value is appended to the host_list file, allowing the application to properly handle emails from this domain.
This commit is contained in:
Simon Larsen 2024-05-31 12:59:23 +01:00
parent f644ac117f
commit 6eb228d0b8
No known key found for this signature in database
GPG Key ID: 96C5DCA24769DBCA
3 changed files with 25 additions and 20 deletions

View File

@ -3,6 +3,7 @@
# Setup auth
echo "domain = $DOMAIN" >> /harakaapp/config/dkim_sign.ini
echo "$DOMAIN" > /harakaapp/config/host_list
echo "$INCOMING_EMAIL_DOMAIN" >> /harakaapp/config/host_list
echo "$DOMAIN" > /harakaapp/config/me
echo "$SMTP_EMAIL=$SMTP_PASSWORD" >> /harakaapp/config/auth_flat_file.ini
@ -23,9 +24,6 @@ echo "Type: TXT"
echo "Key: $DKIM_SELECTOR._domainkey"
echo "v=DKIM1;p=$(grep -v '^-' /harakaapp/config/dkim/$DOMAIN/public | tr -d '\n')"
# Add Hosts
echo $DOMAIN >> /harakaapp/config/host_list.ini
echo $INCOMING_EMAIL_DOMAIN >> /harakaapp/config/host_list.ini
# Run haraka
haraka -c /harakaapp

View File

@ -1,23 +1,30 @@
const MailParser = require('mailparser').MailParser;
// const MailParser = require('mailparser').MailParser;
exports.hook_data_post = function (next, connection) {
// Get the email data
var email_data = connection.transaction.data_lines.join('\n');
// exports.hook_data_post = function (next, connection) {
// // Get the email data
// var email_data = connection.transaction.data_lines.join('\n');
// Parse the email data
var mailparser = new MailParser();
// // Parse the email data
// var mailparser = new MailParser();
mailparser.on('end', function(mail_object){
// Log the email data
connection.loginfo('Subject: ' + mail_object.subject);
connection.loginfo('From: ' + JSON.stringify(mail_object.from));
connection.loginfo('To: ' + JSON.stringify(mail_object.to));
connection.loginfo('Text: ' + mail_object.text);
connection.loginfo('HTML: ' + mail_object.html);
});
// mailparser.on('end', function(mail_object){
// // Log the email data
// connection.loginfo('Subject: ' + mail_object.subject);
// connection.loginfo('From: ' + JSON.stringify(mail_object.from));
// connection.loginfo('To: ' + JSON.stringify(mail_object.to));
// connection.loginfo('Text: ' + mail_object.text);
// connection.loginfo('HTML: ' + mail_object.html);
// });
mailparser.write(email_data);
mailparser.end();
// mailparser.write(email_data);
// mailparser.end();
// next();
// };
exports.hook_rcpt = function (next, connection, params) {
var rcpt = params[0];
this.loginfo("Got recipient: " + rcpt);
next();
};
}