Recover email sended through exim? - email

lost some important data from my server and I know that data was sended via email. I have root access and I need to recover those emails.
I looked into exim logs and I have the email ID, but when I use a command like:
root#server [/var/spool/exim/msglog]# exim -Mvh 1ZfRwk-003bDf-JB
Failed to open input file for 1ZfRwk-003bDf-JB-H: No such file or directory.
Logs looks like:
2015-09-25 08:17:50 1ZfRwk-003bDf-JB <= info#myserver.com U=username P=local S=7453 id=20150925121750.117390002 ...... etc
I am running WHM under centOS
Is possible recover sended mails?
Any help would be appreciated.

No, You can not recover any mail which was send from your server. You can check your 1ZfRwk-003bDf-JB mail logs with the following command so that you can find out full logs of that mail.
grep 1ZfRwk-003bDf-JB /var/log/exim_mainlog

Related

Unable to connect to mail.google.com on motion configuration

I have set up a motion detection camera on my raspberry pi zero w, and it's able to record videos and save pictures and upload them to dropbox but not sending email notifications on_event_start and this is how I defined my on_event_start (on_event_start echo "email body" | mail -s "subject" myEmail#gmail.com). I'm using ssmtp and mailutils for email packages. Although I'm able to send emails through terminal. This is how my ssmtp.conf looks like:
root=postmaster
mailhub=smtp.gmail.com:587
hostname=raspberrypi
AuthUser=myEmail#gmail.com
AuthPass=***********
FromLineOverride=YES
UseSTARTTLS=YES
UseTLS=YES
RewriteDomain=gmail.com
And this is how my revaliases looks like:
root:myEmail#gmail:mail.google.com:587
This is the error that is logged onto the mail.log when motion is detected by the camera.
Unable to connect to "mail.google.com" port 587.
Cannot open mail.google.com:587
Is there something that i'm missing or is there any other way to send an email notification when motion is detected? Someone please help me on this.
Your revaliases file should be pointing to smtp.gmail.com instead of mail.gmail.com. Please try with following in your revaliases file:
root:MyEmailAddress#gmail.com:smtp.gmail.com:587

Download mail using IMAP with fetchmail

I need to download all mail messages from a mail account with fetchmail.
When I try with POP3 I can download all mail correctly in this format:
[root#srv root]# ls /home/mail_import/MAIL_USER/new/
1453828024.7837_0.srv
1453828029.7843_0.srv
But pop3 protocol don't allow to choose a folder, so i need to use IMAP.
I cannot download the mails separately when using IMAP. I tried and I have a single file with all mails.
For example:
[root#srv home]# stat /home/mail_import/MAIL_USER/teste
File: ‘/home/mail_import/MAIL_USER/teste’
[root#srv home]# head /home/mail_import/MAIL_USER/teste
From root#SRV Tue Jan 26 18:56:31 2016
Return-path: <root#SRV >
Envelope-to: MAIL_USER#SRV
Delivery-date: Wed, 02 Dec 2015 15:47:00 -0500
I need to download all mails using imap in separate files like the pop3.
My .fetchmailrc is:
set bouncemail
set no spambounce
set softbounce
set properties ""
defaults:
antispam -1
batchlimit 100
poll DOMAIN with proto IMAP
user 'USER' there with password 'PASS' is 'MAIL' here
options keep fetchall ssl mda "/usr/bin/procmail -f %F -d %T";
folder INBOX
and my .procmailrc is:
MAILDIR=/home/mail_import/MAIL_ACCOUNT
DEFAULT=$MAILDIR/INBOX
LOGFILE=/var/log/procmail
LOCKFILE=$MAILDIR/.default.lock
VERBOSE=on
:0 fhw
|formail
#
## Any other rules the user wishes to either include with INCLUDERC,
## or hardcode into this file, would go here.
## --------------------------------------------------------------------------
## If we're here, the mail didn't match any other rules, so deliver normally.
:0:
$DEFAULT
## If that fails, report an error and throw the mail away.
EXITCODE=75
:0
/dev/null
There is some correct option to download the e-mail using IMAP separately equal POP3?
I don't see why you are using Procmail here at all. Just run Fetchmail and let it fetch your mail. Specify a destination folder in a suitable format, and go.
Whether or not email messages are separate files is not a feature of the protocol. It is a feature of the delivery program you use; if you choose to deliver to a file (Berkeley mbox format; what you are seeing here, with a From_ line at the beginning of every message) then all messages will be delivered to a single file. If you deliver to a folder (in maildir format, for example, with the new tmp cur subdirectories) you will get the result you are asking for. Just do whatever you did to get your POP3 messages into the maildir folder MAIL_USER, only using imap instead of pop3, and you are all set.
If you specifically want to do this in Procmail, change
DEFAULT=$MAILDIR/INBOX
to
DEFAULT=$MAILDIR/
But the entirety of your .procmailrc seems pointless. Why do you pipe stuff through formail? The actions you have simply duplicate Procmail's default behavior, with a couple of bugs. I think you could simplify both your own understanding and the process by figuring out how to have Fetchmail deliver the messages straight where you want them. (Not entirely sure whether it supports maildir, though; quick googling was inconclusive. Maybe don't specify an mda at all if that's how you made this happen with POP3.)

Sending Emails With GitLab not working correctly

I'm trying to troubleshoot why GitLab Omnibus is not sending automated emails using Postfix, which is already installed and configured correctly (it's being used by other applications installed on the server as well).
When I make a change to an issue, while tailing the Gitlab logs, this is what I'm noticing:
==> /var/log/gitlab/sidekiq/current <==
2015-04-03_20:06:30.79386 2015-04-03T20:06:30.793Z 8126 TID-aq3vk Sidekiq::Extensions::DelayedMailer JID-460531f571f6756908805d66 INFO: start
2015-04-03_20:06:31.53363 sendmail: recipients with -t option not supported
==> /var/log/gitlab/gitlab-rails/production.log <==
Sent mail to user#company.com (48.3ms)
==> /var/log/gitlab/sidekiq/current <==
2015-04-03_20:06:31.57039 2015-04-03T20:06:31.570Z 8126 TID-aq3vk Sidekiq::Extensions::DelayedMailer JID-460531f571f6756908805d66 INFO: done: 0.776 sec
I sanitized the email address, but it is sending to a correct address.
I'm guessing the issue is related to the " sendmail: recipients with -t option not supported"
However, I cannot find anybody else out there who has had this issue.
Thanks.
I fixed this issue by switching GitLab to SMTP by following the guide here: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/smtp.md
It seems like SMTP is documented in greater detail.

Change Exim file with WHM Cpanel

Hi i started using osTicket for my helpdesk and i was able to do the Email pipe successfully, but even if the ticket is created, the user receives: Mail delivery failed: returning message to sender.
In osTicket it says to change de exim document, but i have WHM and i don't know how to change it.
Can someone tell me how to change the following using the WHM editor
driver = pipe
return_output
driver = pipe
group = "${lookup{$domain}lsearch* {/etc/userdomains}{$value}}"
return_output
user = "${lookup{$domain}lsearch* {/etc/userdomains}{$value}}"
i need to change the return_output to return_fail_output
Sounds like you need to change your EXIM config file. In WHM, you can go to: Service Configuration -> Exim Configuration and click on 'Advanced Editor' (at the bottom) to have access to it.
I will warn to be careful in there as it may cause issues, but that's where it looks like you'll want to put your rules and such.

No such file or directory. Sending Attachments

I have built a php mail system. now I want to also send attachments whit the email's. I have the files for the attachments uploaded to my server and want it with the following piece of code sent with the email.
<?php
$mail_ontvanger->addAttachment($filesOb->c_file_name, 'home/httpd/vhosts/mysite.nl/subdomains/user/httpdocs/beheer/uploads/', $filesOb->c_file_name);
?>
If I do this I than I get an error: (failed to open stream: No such file or directory in...)
I myself think that the error caused by wrong \ in directory ('home/httpd/vhosts/mysite.nl/subdomains/user/httpdocs/beheer/uploads/'). but this cant not solve the problem.
When I send an email with attachments on then the mail as usual with me in my mail box, only the file is empty.
The error is pretty obvious; it can't find the file you're trying to attach. Maybe it's due to the path being incorrect? Try this:
$mail_ontvanger->addAttachment($filesOb->c_file_name, '/home/httpd/vhosts/mysite.nl/subdomains/user/httpdocs/beheer/uploads/', $filesOb->c_file_name);
In any case, it's better to use relative paths.