CodeIgniter Mail + Exim4 - email

i've set up Exim4 on my Ubuntu machine.
I've started learning CodeIgniter and when sending an e-mail through there email library i get the following if I ask for the debug status. Looks OK i suppose, but i never receive e-mail on jandante#telenet.be. Also doesn't work for jandante.meulemeester#gmail.com, anyone has an idea?
220 Concept-IT ESMTP Sendmail 8.14.3/8.14.3/Debian-9.1ubuntu1; Fri, 3 Sep 2010 18:15:59 +0200; (No UCE/UBE) logging access from: localhost(OK)-localhost [127.0.0.1]
hello: 250-Concept-IT Hello localhost [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-EXPN
250-VERB
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-AUTH DIGEST-MD5 CRAM-MD5
250-DELIVERBY
250 HELP
from: 250 2.1.0 ... Sender ok
to: 250 2.1.5 ... Recipient ok
data: 354 Enter mail, end with "." on a line by itself
250 2.0.0 o83GFx3a021848 Message accepted for delivery
quit: 221 2.0.0 Concept-IT closing connection
Your message has been successfully sent using the following protocol: smtp
User-Agent: CodeIgniter
Date: Fri, 3 Sep 2010 18:15:59 +0200
From: "Concept-IT"
Return-Path:
To: jandante#telenet.be
Subject: =?utf-8?Q?Uw_nieuw_wachtwoord_voor_Concept-IT_CRM?=
Reply-To: "info#concept-it.be"
X-Sender: info#concept-it.be
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <4c811f3f98626#concept-it.be>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Uw gebruikersnaam is: liesbeth en uw wachtwoord is: 6ZiKJxD.

As you can read in my comments my problem comes from my ISP. Which doesn't allow me to send mail from my server.
I've followed the following tutorial to make Exim4 send mail through Google Mail: http://www.manu-j.com/blog/wordpress-exim4-ubuntu-gmail-smtp/.
Works like a charm.

Related

How can I send a custom Delivery Status Notification over Postfix SMTP server?

I'm trying to send out the following Mime message through my mail SMTP server which is Postfix.
From: Webmaster <webmaster#ourdomain.com>
Date: Sat, 06 Feb 2021 23:50:56 +0100
Subject: Delivery Status Notification (Failure)
Message-Id: <GII2AYZOWCU4.AXDWNKVKJ4XD3#ourdomain.com>
To: First Last <someone#gmail.com>
Return-Path: <>
MIME-Version: 1.0
Content-Type: multipart/report; boundary="=-HnKieASbitf0LQ3XjF16Mw==";
report-type=delivery-status
--=-HnKieASbitf0LQ3XjF16Mw==
Content-Type: text/plain
Attachment not allowed
--=-HnKieASbitf0LQ3XjF16Mw==
Content-Type: message/delivery-status
Reporting-MTA: dns;mail.ourdomain.com
Final-Recipient: rfc822;user#ourdomain.com
Action: failed
Status: 550 5.7.1
--=-HnKieASbitf0LQ3XjF16Mw==--
The problem I'm having is that Postfix sends the message as a regular massage with the related parts stripped.
Is it not possible to send a custom DSN message manually?

Mail delivery failed: returning message

We got a server with mails and several clients send us this issue can somebody help with this issue?
subject: Mail delivery failed: returning message to sender
This message was created automatically by mail delivery software.
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:
elise.dullers#spectrumstudent.be
SMTP error from remote mail server after end of data:
host ASPMX.L.GOOGLE.COM [2a00:1450:4013:c00::1b]:
550-5.7.1 [2a01:7c8:aaaa:3e7::1] Our system has detected that this message does
550-5.7.1 not meet IPv6 sending guidelines regarding PTR records and
550-5.7.1 authentication. Please review
550-5.7.1 https://support.google.com/mail/?p=IPv6AuthError for more information
550 5.7.1 . z13si75087edl.403 - gsmtp
------ This is a copy of the message, including all the headers. ------
Return-path: Received: from
109.131-67-87.adsl-dyn.isp.belgacom.be ([87.67.131.109] helo=[192.168.1.55]) by server.ireto.be with esmtpa (Exim 4.83)
(envelope-from ) id 1egDid-0005am-Ee for
elise.dullers#spectrumstudent.be; Mon, 29 Jan 2018 18:59:48 +0100
SavedFromEmail: info#beringsetaxi.be Date: Mon, 29 Jan 2018 18:59:44
+0100 Subject: Re: Kostprijs taxi In-Reply-To:
Importance: normal From: info To: Elise Dullers
MIME-Version: 1.0 Content-Type:
multipart/alternative;
boundary="--_com.samsung.android.email_2340489603438420"
----_com.samsung.android.email_2340489603438420 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: base64

James not sending emails to foreign server

community
I already installed James in my machine. I configured it. I did a telnet on 4555 port and I added several users. Then I did a telnet on 25 port, and I sent a mail to an outside email address like this
ehlo leo#localhost
...
mail from: <leo#localhost>
250 2.1.0 Sender <leo#localhost> OK
rcpt to: <lroura#uci.cu>
250 2.1.5 Recipient <lroura#uci.cu> OK
data
354 Ok Send data ending with <CRLF>.<CRLF>
subject: otr prueba
jejejejje
.
250 2.6.0 Message received
In leo inbox appears a message like this
Return-Path: <>
Delivered-To: leo#localhost
Date: Wed, 21 Oct 2015 14:04:29 -0500 (GMT-05:00)
From: postmaster#localhost
To: leo#localhost
Message-ID: <33108879.3.1445454269196.JavaMail.root#mypc>
In-Reply-To: <23978087.1.1445454269122.JavaMail.root#mypc>
Subject: Re:otr prueba
MIME-Version: 1.0
Content-Type: multipart/report;
boundary="----=_Part_2_22845834.1445454269146";
report-type=delivery-status
------=_Part_2_22845834.1445454269146
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hi. This is the James mail server at mypc.
I'm afraid I wasn't able to deliver your message to the following addresses.
This is a permanent error; I've given up. Sorry it didn't work out. Below
I include the list of recipients and the reason why I was unable to deliver
your message.
Failed recipient(s):
lroura#uci.cu
Error message:
554 5.7.1 <unknown[10.31.105.115]>: Client host rejected: Access denied
------=_Part_2_22845834.1445454269146
Content-Type: message/delivery-status; name=status.dat
Content-Transfer-Encoding: 7bit
Content-Description: Delivery Status Notification
Content-Disposition: attachment; filename=status.dat
Reporting-MTA: dns; mypc
Received-From-MTA: dns; localhost
Final-Recipient: rfc822; lroura#uci.cu
Action: failed
Status: 5.7.1
Diagnostic-Code: smtp; 554 5.7.1 <unknown[10.31.105.115]>: Client host rejected: Access denied
Last-Attempt-Date: Wed, 21 Oct 2015 14:03:58 -0500 (GMT-05:00)
------=_Part_2_22845834.1445454269146
Content-Type: message/rfc822; name="otr prueba"
Content-Disposition: Attachment; filename="otr prueba"
Message-ID: <23978087.1.1445454269122.JavaMail.root#mypc>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Received: from localhost ([127.0.0.1])
by mypc (JAMES SMTP Server 2.3.2) with SMTP ID 269
for <lroura#uci.cu>;
Wed, 21 Oct 2015 14:03:58 -0500 (GMT-05:00)
Date: Wed, 21 Oct 2015 14:03:58 -0500 (GMT-05:00)
From: leo#localhost
subject: otr prueba
jejejejje
------=_Part_2_22845834.1445454269146--
What can I do in order to send an email to a outside server using James?
#Leandro Roura Sixto: Hi. Basically the SMTP error code 554 is thrown when the receiver identifies your machine as a source of SPAM or a relay host. This is typically caused by the domain of leo i.e. localhost. Add some meaningful host like gmail or yahoo, you will be able to get through the SPAM Filter of the receiver's mail server/ SMTP.

Postfix thinks the system email is local

I installed Postfix on an Ubuntu 14.04 server running Nginx. While I was installing it, I put the system email as 'info#mydomain.com' not realising that it would now think that this was a local mailbox. This email address is a gmail account and so the server needs to look at the MX records.
I'm guessing what is happening is that it sees that its a local address and just sends it locally. I sent a test with:
echo "This is the body of the email" | mail -s "This is the subject line" info#mydomain.com
And sure enough in /var/mail/root there was a message:
From MAILER-DAEMON Wed Sep 30 19:05:59 2015
Return-Path: <>
X-Original-To: root#mydomain.com
Delivered-To: root#mydomain.com
Received: by mydomain.com (Postfix)
id 5D29F1249E9; Wed, 30 Sep 2015 19:05:59 -0400 (EDT)
Date: Wed, 30 Sep 2015 19:05:59 -0400 (EDT)
From: MAILER-DAEMON#mydomain.com (Mail Delivery System)
Subject: Undelivered Mail Returned to Sender
To: root#mydomain.com
Auto-Submitted: auto-replied
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
boundary="52BC21249E1.1443654359/mydomain.com"
Message-Id: <20150930230559.5D29F1249E9#mydomain.com>
This is a MIME-encapsulated message.
--52BC21249E1.1443654359/mydomain.com
Content-Description: Notification
Content-Type: text/plain; charset=us-ascii
This is the mail system at host mydomain.com.
I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.
For further assistance, please send mail to postmaster.
If you do so, please include this problem report. You can
delete your own text from the attached returned message.
The mail system
<info#mydomain.com>: unknown user: "info"
--52BC21249E1.1443654359/mydomain.com
Content-Description: Delivery report
Content-Type: message/delivery-status
Reporting-MTA: dns; mydomain.com
X-Postfix-Queue-ID: 52BC21249E1
X-Postfix-Sender: rfc822; root#mydomain.com
Arrival-Date: Wed, 30 Sep 2015 19:05:59 -0400 (EDT)
Final-Recipient: rfc822; info#mydomain.com
Action: failed
Status: 5.1.1
Diagnostic-Code: X-Postfix; unknown user: "info"
--52BC21249E1.1443654359/mydomain.com
Content-Description: Undelivered Message
Content-Type: message/rfc822
Return-Path: <root#mydomain.com>
Received: by mydomain.com (Postfix, from userid 0)
id 52BC21249E1; Wed, 30 Sep 2015 19:05:59 -0400 (EDT)
Subject: This is the subject line
To: <info#mydomain.com>
X-Mailer: mail (GNU Mailutils 2.99.98)
Message-Id: <20150930230559.52BC21249E1#mydomain.com>
Date: Wed, 30 Sep 2015 19:05:59 -0400 (EDT)
From: root#mydomain.com (root)
This is the body of the email
--52BC21249E1.1443654359/mydomain.com--
I'm not sure how I can get the server to send the emails to the right place? Should I change the system email to something random?
I'm guessing that you've probably got the machine installed with mydomain.com as the hostname and so Postfix is configured to think it's answering email for mydomain.com. You probably want to edit your /etc/postfix/main.cf and remove your domain from the mydestination line there. (And then restart Postfix.)

Why does Perl's MIME::Lite fail with " SMTP data() command failed: 2.1.5 ... Recipient ok"?

This is probably a crossover question that is valid for both SO and SF.
I am using a Perl script as follows to send e-mail:
my $SMTP_SERVER = 'xx.xx.xx.xx';
my $DEFAULT_SENDER = 'yyy#xxx.com';
my $DEFAULT_RECIPIENT = 'yyy#xxx.com';
### Create the multipart "container":
$msg = MIME::Lite->new(
From =>$DEFAULT_SENDER,
To =>$input{to},
Cc =>$DEFAULT_SENDER,
Subject =>$input{mailsubject},
Type =>'multipart/mixed'
);
my $msgbody="<body bgcolor=\"#C0C0C0\">\n";
$msgbody.="<img src="cid:xyz.gif"><br>O hai thar.."
$msgbody.="</body>";
### Add the text message part:
### (Note that "attach" has same arguments as "new"):
$msg->attach(
Type =>'text/html',
Data =>$msgbody
);
### Add the logo image part:
$msg->attach(
Type => 'image/gif',
Id => 'xyz.gif',
Path => '/var/www/images/xyz.gif',
);
### Add the file part:
$msg->attach(
Type =>'application/zip',
Path =>$input{fullpath},
Filename =>$input{file},
Disposition => 'attachment'
);
open ERROR, '>>', "/debug/error.txt" or die $!;
STDERR->fdopen( \*ERROR, 'w' );
eval{
# send the email
MIME::Lite->send('smtp', $SMTP_SERVER, Timeout=>30, Debug=>1, Notify => ['FAILURE','DELAY'], SkipBad => 1 );
$msg->send();
1;
}
or do{&error($#)};
close ERROR;
Now this script works lovely for 98% of the e-mails sent.. however.. the big 2% client is the one I am trying to figure out now. Whenever I send to this client in particular I get the message: SMTP data() command failed: 2.1.5 ... Recipient ok .
Has anyone seen this error before or have any idea as to where my problem is? I tried replacing the X-Mailer: header thinking that was being spam filtered. I tried sending the same message to others on our domain and that works just not to this client URL.
example header below:
MIME-Version: 1.0
Content-Transfer-Encoding: binary
Content-Type: multipart/mixed;
boundary="_----------=_12845827796770"
X-Mailer: MIME::Lite 3.027 (F2.76; T1.29; A2.03; B3.07_01; Q3.07)
Date: Wed, 15 Sep 2010 13:37:59 -0700
From: yyy#xxx.com
To: client1#clienturl.com, client2#clienturl.com, me#xxx.com
Cc: yyy#xxx.com
Subject: TEST
Any clues?
Also, sending an e-mail directly using Outlook with same attachments works perfectly with this client and same smtp server. It is only when being sent via this automated process that the error rears it's ugly head.
Update:
Debug Log (which has me thinking it is a big latency issue where the responses are coming back asynch and hosing up the normal flow of operations in the process of MIME::Lite)
MIME::Lite::SMTP>>> MIME::Lite::SMTP
MIME::Lite::SMTP>>> Net::SMTP(2.31)
MIME::Lite::SMTP>>> Net::Cmd(2.29)
MIME::Lite::SMTP>>> Exporter(5.62)
MIME::Lite::SMTP>>> IO::Socket::INET(1.31)
MIME::Lite::SMTP>>> IO::Socket(1.30_01)
MIME::Lite::SMTP>>> IO::Handle(1.27)
MIME::Lite::SMTP=GLOB(0x84ac258)<<< 220 smpt.xxx.com ESMTP Sendmail 8.12.9/8.13.1; Wed, 15 Sep 2010 16:50:44 -0700 (PDT)
MIME::Lite::SMTP=GLOB(0x84ac258)>>> EHLO localhost.localdomain
MIME::Lite::SMTP=GLOB(0x84ac258)<<< 250-smpt.xxx.com Hello [xx.xx.xx.xx], pleased to meet you
MIME::Lite::SMTP=GLOB(0x84ac258)<<< 250-ENHANCEDSTATUSCODES
MIME::Lite::SMTP=GLOB(0x84ac258)<<< 250-PIPELINING
MIME::Lite::SMTP=GLOB(0x84ac258)<<< 250-8BITMIME
MIME::Lite::SMTP=GLOB(0x84ac258)<<< 250-SIZE
MIME::Lite::SMTP=GLOB(0x84ac258)<<< 250-DSN
MIME::Lite::SMTP=GLOB(0x84ac258)<<< 250-ETRN
MIME::Lite::SMTP=GLOB(0x84ac258)<<< 250-DELIVERBY
MIME::Lite::SMTP=GLOB(0x84ac258)<<< 250 HELP
MIME::Lite::SMTP=GLOB(0x84ac258)>>> MAIL FROM:<yyy#xxx.com>
MIME::Lite::SMTP=GLOB(0x84ac258)<<< 250 2.1.0 <yyy#xxx.com>... Sender ok
MIME::Lite::SMTP=GLOB(0x84ac258)>>> RCPT TO:<client1#clienturl.com>
[Wed Sep 15 16:41:22 2010] myemailscript.cgi: MIME::Lite::SMTP=GLOB(0x84ac258): Timeout at /usr/local/share/perl/5.10.0/MIME/Lite.pm line 2889
MIME::Lite::SMTP=GLOB(0x84ac258)>>> RCPT TO:<client2#clienturl.com>
[Wed Sep 15 16:41:52 2010] myemailscript.cgi: MIME::Lite::SMTP=GLOB(0x84ac258): Timeout at /usr/local/share/perl/5.10.0/MIME/Lite.pm line 2889
MIME::Lite::SMTP=GLOB(0x84ac258)>>> RCPT TO:<me#xxx.com>
[Wed Sep 15 16:42:22 2010] myemailscript.cgi: MIME::Lite::SMTP=GLOB(0x84ac258): Timeout at /usr/local/share/perl/5.10.0/MIME/Lite.pm line 2889
MIME::Lite::SMTP=GLOB(0x84ac258)>>> RCPT TO:<yyy#xxx.com>
MIME::Lite::SMTP=GLOB(0x84ac258)<<< 250 2.1.5 <client1#clienturl.com>... Recipient ok
MIME::Lite::SMTP=GLOB(0x84ac258)>>> DATA
MIME::Lite::SMTP=GLOB(0x84ac258)<<< 250 2.1.5 <client2#clienturl.com>... Recipient ok
The Net::SMTP client appears to be timing out, but the responses to the RCTP TO's are arriving eventually when they are no longer expected. Try setting the timeout to 300 seconds instead of 30?