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
Related
I am trying to figure out EXM for Sitecore. I installed it and now I am trying to configure it to send emails from my local machine. SAC MTA is not an option because I don't have access to App Center. I am left with custom MTA.
I was trying to configure config files to use gmail smtp:
Sitecore.EDS.Providers.CustomSmtp.config
<smtpSettings type="Sitecore.EDS.Core.Net.Smtp.SmtpSettings, Sitecore.EDS.Core" singleInstance="true">
<server>smtp.gmail.com</server>
<port>465</port>
<userName>*****#gmail.com</userName>
<password>*****</password>
<authenticationMethod>Login</authenticationMethod>
<startTls>true</startTls>
<proxySettings ref="exm/eds/proxySettings" />
</smtpSettings>
Sitecore.EDS.Providers.CustomSmtp.Sync.config
<pop3Settings>
<pop3Setting type="Sitecore.EDS.Core.Net.Pop3.Pop3Settings, Sitecore.EDS.Core" singleInstance="true">
<server>pop.gmail.com</server>
<port>995</port>
<userName>****#gmail.com</userName>
<password>****</password>
<useSsl>true</useSsl>
<startTls>true</startTls>
<proxySettings ref="exm/eds/proxySettings"/>
</pop3Setting>
</pop3Settings>
But when I try to "send quick test" through EXM I get "Failed to connect to the email server. Please try again later". Can anyone help me with that configuration. And is it even possible? I remember reading something about paid license to use custom MTA. Would it mean, that you need to pay to send email via EXM?
To switch from using the Sitecore MTA to using the Custom SMTP, you must disable the Dyn configurations and then enable the CustomSmtp configurations:
In the Website\App_Config\Include\EmailExperience folder, add the suffix .disabled to the end of the following file names:
Sitecore.EDS.Providers.Dyn.config
Sitecore.EDS.Providers.Dyn.Sync.config
In the Website\App_Config\Include\EmailExperience folder, remove the suffix .disabled from the following file names:
Sitecore.EDS.Providers.CustomSmtp.config.disabled
Sitecore.EDS.Providers.CustomSmtp.Sync.config.disabled
For the past few days I've been strugling with finding a way to send emails from my app. This is the sample code I am currently using. It think, by using this method, I might be unable to handle the situation of an improper setting of the mail accound of the computer my app will be running, so I thought about using a different method. I was wondering if is there any MessageUI equivalent for mac os. Is there any MessageUI equivalent for mac os. Any ideas?
There are two ways to do that:
AppleScript framework
NSSharingService
NSSharingService to compose mail:
let service = NSSharingService(named: NSSharingServiceNameComposeEmail)
service?.recipients = ["test#gmail.com"]
service?.subject = "Test Mail"
service?.performWithItems(["Test Mail body"])
Launch Mail App
If you just want to open Mail app, try below code:
NSWorkspace.sharedWorkspace().launchApplication("Mail")
Improper Setting:
If account is not configured on the system, this code will show configuration window for mail
When user will try to send mail it'll be shown improper setting related error by Mail app so you need not to bother about it
If you want to use other then Mail app, just try your own mail system, native mail client or third party mail framework.
Try from terminal:
You can use shell script to send mail using native client
mail -s "Hello" "test#gmail.com" <<EOF
Hello, Test!
EOF
For Swift 4, little changes.
let service = NSSharingService(named: NSSharingService.Name.composeEmail)
service?.recipients = ["test#gmail.com"]
service?.subject = "Test Mail"
service?.perform(withItems: ["Test Mail body"])
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
I'm trying to send an email using Ansible, but I can't understand how it works as I don't know how to provide user and password for such service (not specified in the documentation).
Both my machine and the email server are in the same network, but I need to be authenticated in order to send the email.
This is my yml file:
---
- name: Testing email
hosts: localhost
tasks:
- name: Send email
local_action: mail
host=mail.server.com
port=993
subject="Ansible test mail"
body="Testing email"
from=my#email
to="y#email
charset=utf8
And this is the related content of the hosts' file:
[localhost]
localhost ansible_connection=local
Any idea about how should I configure it? Thanks in advance.
Looking at the source code for the mail module ( https://github.com/ansible/ansible/blob/d1effecb2ef073e478c67a7ca39cf56708a66a48/library/notification/mail ) it doesn't look like it supports SMTP authentication.
It shouldn't be too hard to add support for it however. It would require adding the username and password parameters to the module, detecting if they've both been supplied, and if so, calling smtp.login() with those parameters.
In fact, it looks like there's two pull requests to do exactly that at the moment here
https://github.com/ansible/ansible/pull/7213
and here
https://github.com/ansible/ansible/pull/6667
So support will most likely be added in dev soon.
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.