EzDevInfo.com

exim interview questions

Top exim frequently asked interview questions

Exim piping for forwarding to rails controller

I am using Exim. I am trying to "send" all emails to a rails controller, but unfortunately I have no experience with Piping emails. Any help with the configuration of Exim is welcome. What i want is that Exim should forward all emails that are going to "bounce", because no such user exists, to the script


Source: (StackOverflow)

Set email headers so bounced emails go to a specific address

From our rails app we send out some system-generated emails with the 'from' address set to noreply@ourdomain.com. If these bounce they get sent back to this address by our mail server. However, what i'd like to do is to not have bounced emails get sent back to noreply@ourdomain.com but to a different address, such as bounced@ourdomain.com.

Is there a header or something i can set in the email that will achieve this, without me having to go and investigate the vagaries of our email server? We send the mails out using exim in case that's relevant.

cheers, max


Source: (StackOverflow)

Advertisements

How could I stop PHP from returning headers when executed from commandline?

This may be a ridiculous question, but it's been bothering me for a while. I have a mail forwarder piped to a PHP script, it receives perfectly, however I have the following error mailed back to me instantly:

A message that you sent could not be delivered to one or more of its recipients. This is a permanent error. The following address(es) failed:

  pipe to |/home/[webroot]/public_html/external/mobile/email.php
    generated by mobile@[mydomain]

The following text was generated during the delivery attempt:

X-Powered-By: PHP/5.2.13 
Content-type: text/html

As you can see, Exim thinks the header response an error from the script I have. The script can receive the Email perfectly from php://stdin but Exim is quick-replying with the error.

Plus,

  • It's running from console, not Apache so HTAccess or configuring Apache most likely would do nothing.
  • I can not find any solution, or anyone with the same problem.

So my question is: How to I get rid of those two headers?

Thanks, ~Jonny

Edit, Source:

    #!/usr/bin/php
<?php
    $fd = fopen("php://stdin", "r");
        $email = "";
        while (!feof($fd)) {
         $email .= fread($fd, 1024);
        }
        fclose($fd);

        $dat = fopen(dirname(__FILE__).'/test.txt', 'w');
        fwrite($dat, $email);
        fclose($dat);

Source: (StackOverflow)

Unable to sent mail using exim4.8 - Unrouteable Address

I am unable to send mails using exim4.8. Please find the below logs and my exim config file. Please help! Tried all config changes but not able to find a solution.

Thanks in advance.

Below is the eximgrep result:

exigrep "xyz" /var/spool/exim/log/mainlog

2013-07-19 17:43:01 1V09YT-0006vZ-Ax <= root@192.168.4.14 U=root P=local S=419
2013-07-19 17:43:01 1V09YT-0006vZ-Ax ** yyy@yyy.yyy: Unrouteable address
2013-07-19 17:43:01 1V09YT-0006vZ-Ax Completed

Below is my Exim config file:

primary_hostname = 192.168.4.14

domainlist local_domains = @:localhost
domainlist relay_to_domains = *
hostlist   relay_from_hosts = 127.0.0.1

acl_smtp_rcpt = acl_check_rcpt
acl_smtp_data = acl_check_data
rfc1413_hosts = *
rfc1413_query_timeout = 5s



ignore_bounce_errors_after = 1d

timeout_frozen_after = 7d

begin acl

  deny    message       = Restricted characters in address
          domains       = +local_domains
          local_parts   = ^[.] : ^.*[@%!/|]


  deny    message       = Restricted characters in address
          domains       = !+local_domains
          local_parts   = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
  accept  local_parts   = postmaster
          domains       = +local_domains

  require verify        = sender

  accept  hosts         = +relay_from_hosts
          control       = submission
          control       = dkim_disable_verify


  accept  authenticated = *
          control       = submission
          control       = dkim_disable_verify

  require message = relay not permitted
          domains = +local_domains : +relay_to_domains

  require verify = recipient

$dnslist_domain\n$dnslist_text
$dnslist_domain
  accept

acl_check_data:

  accept


begin routers
smart_route:
driver=manualroute
transport=remote_smtp

route_data=bamail2.nova.local
no_more
system_aliases:
  driver = redirect
  allow_fail
  allow_defer
  data = ${lookup{$local_part}lsearch{/etc/aliases}}
# user = exim
  file_transport = address_file
  pipe_transport = address_pipe


userforward:
  driver = redirect
  check_local_user
  file = $home/.forward
  no_verify
  no_expn
  check_ancestor
  file_transport = address_file
  pipe_transport = address_pipe
  reply_transport = address_reply

localuser:
  driver = accept
  check_local_user
  transport = local_delivery
  cannot_route_message = Unknown user

begin transports


remote_smtp:
  driver = smtp

  interface = 10.50.50.41

address_pipe:
  driver = pipe
  return_output


address_file:
  driver = appendfile
  delivery_date_add
  envelope_to_add
  return_path_add

address_reply:
  driver = autoreply

begin retry

*                      *           F,2h,15m; G,16h,1h,1.5; F,4d,6h

begin rewrite


begin authenticators

Source: (StackOverflow)

exim redirect mail to a script

I am looking to set up a mail relay so that any mail sent to for example

@example.com

gets parsed be a PHP script.

I know to do this for indervidual address I could do some thing like

(from the following web site http://evolt.org/incoming_mail_and_php)

Con figure an Aliases such as

script: |/our/script.php

then any emails sent to script@example.com will be passed to the script given..

but how can I make it that every email to @example.com is passed to the script? thank you


Source: (StackOverflow)

Exim - A lot of frozen messages without sender

I'm new to Exim and I'm using it as a smarthost (to recive emails from users and send it to my ISP). enter image description here

The system is working ok, but I have some problems with frozen messages. I watch the queue sometimes and there are some frozen messages without sender, so Exim cannot send them, because if there isn't sender it can't authenticate with the ISP.

Where can I start to debug this?

Thanks a millon.


Source: (StackOverflow)

Go interactive with external program from PHP

I'd say it's quite a simple question but I'm stuck with it:

I need to communicate with external program (specifically, Exim) run with some debug options. As I run it from linux shell, it goes like this: run exim -bh 11.22.33.44, then read its output (both STDOUT and STDERR), the type in some line from SMTP dialog, then read Exim output again, type another SMTP line and so on. And it's nicely works while I'm on bash shell, but as I run it from PHP script it stuck in STDIN read loop.

I use proc-open:

$descriptorspec = array(
    0 => array("pipe", "r"), 
    1 => array("pipe", 'w'), 
    2 => array("pipe", 'w')
);
$process=proc_open('/usr/sbin/exim -bh 11.22.33.44', $descriptorspec, $pipes, NULL, NULL);
if (is_resource($process)) {
    stream_set_blocking($pipes[1], 1);
    stream_set_blocking($pipes[2], 1);
    while(!feof($pipes[2])) {
        $txt2 = fgets($pipes[2]);
    }
    while(!feof($pipes[1])) {
        $txt2 = fgets($pipes[1]);
    }
    fwrite($pipes[0], 'HELO testhost');
...
}

Looks simple, but as it goes to the end of first STDERR, it stuck.

Tried both blocking and unblocking mode, tried to swap reading from STDERR and STDIN - no luck so far.

Please point me the right way to do that!


Source: (StackOverflow)

Exim: Forward Based on Recipient in bcc

Currently I am filtering incoming mails by a .forward in the following way:

if $header_to: matches "(office|info)@domain.com" then
    save Maildir/.office/
endif
if $header_to: matches "whatever@domain.com" then
    save Maildir/.whatever/
endif

So I have a mail account, which receives mails for different addresses. Basically I want them to land in different subdirs based on the address the mail was sent to.

This works for mails where the recipient is in the to-header, but does not work if the recipient was in the bcc.

When a mail is received which was sent with the bcc-header, only the envelope-to-header matches the real address the mail is delivered to and it is mentioned in a Received-header

Envelope-to: office@domain.com

Received: from mail.other.domain ([1.1.1.1])
    by mail.domain.com with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
    (Exim 4.71)
    (envelope-from <sender@other.domain>)
    id 1RO5xc-0001TF-Qj
    for office@domain.com; Wed, 09 Nov 2011 12:04:57 +0100
...
To: can_be_anything@whatever.com

I already tried:

if $header_envelope-to: matches ...

but this does not work, mails are not filtered at all even when sent with To-header (looks like the Envelope-To-header is not available in forward-files). Should I try to parse the (multiple) Received-headers?

How can I move mails into a subdir of the recipient based on the real recipient address?


Source: (StackOverflow)

Send output of cron runs to an external e-mail address from EC2 instance

What I want to do is pretty simple - I want the output from cron on an EC2 instance to go to an external e-mail address. I've clearly done some wrong things, though, and am confused.

I've configured exim4 to use gmail as a smart host, but somehow I've managed to do something to get the e-mails from the cron daemon to come as From: Cron Daemon <email address from /etc/exim4/passwd.client>. Why has cron decided to run as me?

I have

root: external@email.com
user-account: external@email.com

in /etc/aliases. However, I get emails sent to that say

Delivery to the following recipient failed permanently:
root@domu-____.compute-1.internal

Why is exim4 trying to reach root by such a weird-looking e-mail address? I could theoretically add domu-(redacted).compute-1.internal as a local domain in the exim4 config, but these are dynamically provisioned instances, and that would be a real pain, and I also don't know where in the world that domain is coming from - hostname -f gives ip-11-11-11-11.ec2.internal. What have I done to make cron do something other than just send to root@localhost (which given my config would work fine)?


Source: (StackOverflow)

Exim/ACL: How to whitelist users when rejecting emails with disallowed mime attachments

Debian Squeeze/Exim 4.72: ACL

I have the more or less standard exim acl for rejecting emails based on mime attachments with some common compressed file extensions added in (.zip/.rar etc.)

  deny      set acl_m1      = ${extract{-1}{.}{${lc:$mime_filename}}}
            message         = This message contains a prohibited file extension ($acl_m1)
            log_message     = REJECTED ATTACHMENT ($acl_m1)
            condition       = ${if match{$acl_m1}\N^(ade|adp|bas|bat|chm|cmd|com|cpl|crt|eml|enc|exe|hlp|hta|inf|ins|isp|js|jse|mdb|lnk|mde|msc|msi|msp|mst|pcd|pif|rar|reg|scr|sct|shs|url|vbs|vbe|wsf|wsh|wsc|zip)$\N}{1}{0}}

Q: How would I use a "Whitelist" to allow specific users to receive emails containing attachments of a certain type (e.g. .zip)?

Thx


Source: (StackOverflow)

Exim Catch email and forward to address

I have dedicated server with many domains on it. I want to catch all emails from specific addresses for any domain that means accepting all emails from xxx@example.com and forward it to a specific address.

I used, Exim on my server and cpanel.

I don't want a method to accept and forward on one account!


Source: (StackOverflow)

I can't find exim on the latest cygwin installation

I can't find exim on the latest cygwin installation (1.7.29). Was it removed? How can I install it in such a case?


Source: (StackOverflow)

Messed up Exim queue - messages with header file but no data

My Exim mail queue was full of spam so I ran a custom grep command to search out spooled messages that contained the spam terms. Problem is, I didn't know that Exim breaks messages up into multiple files (one for header information, one for data, etc.) so my grep command deleted the data files while leaving the header files.

Does anyone know of a way I can easily find and delete messages in the queue that have a header file but no data file? Or another way to fix it?


Source: (StackOverflow)

Check whm root access logs in cpanel

Pardon me if it is a basic question, actually I am a novice in administrating cpanel but I want to see cpanel's root WHM login logs. How can I see that?


Source: (StackOverflow)

Best solution for send newsletter with codeigniter

please help me for best solution send newsletter never server exim banned and ip blocked ,i have share hosting, if you have a good script suggest me,t hank you every one


Source: (StackOverflow)