I am using Exim and Dovecot.
I want add to all outgoing email an anti-abuse header like:
X-Report-Abuse: TEXT to report abuse
How I can do this?
Thanks in advance
Thanks, this is not helping me.
I added the line where you told but also incoming email have the X-Report-Abuse heder.
I cannot find that on my Exim
send_to_gateway:
I added the headers_add = X-Report-Abuse: TEXT to report abuse here:
This transport is used for delivering messages over SMTP connections.
remote_smtp:
driver = smtp
dkim_domain = ${lc:${domain:$h_from:}}
dkim_selector = x
dkim_private_key = /etc/exim/dkim.private.key
dkim_canon = relaxed
headers_add = X-Report-Abuse: Please report any abuse text
this is working if the outgoing email are sent from an email client, is not working if email is sent by SMTP from a PHP script or app like wordpress or other PHP app.
This adds a header to outgoing messages:
Add this line to your exim.conf file within your outgoing router(s) configuration:
headers_add = X-Report-Abuse: TEXT to report abuse
For example
begin routers
...
send_to_gateway:
driver = manualroute
domains = !+local_domains
transport = remote_smtp
route_list = * smtp.myisp.net
headers_add = X-Report-Abuse: TEXT to report abuse
dnslookup:
driver = dnslookup
domains = ! +local_domains
transport = remote_smtp
ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
headers_add = X-Report-Abuse: TEXT to report abuse
no_more
Related
I'm trying to send emails using R, which will eventually be deployed in a Shiny application. I've got an Office 365 account which is able to send email if I log into it but using the SMTP server I'm not getting any connection so far.
I've tried packages mailR & emayili but I'm not getting anywhere for some reason. I've used our local mail server before and that worked but that won't work for a shiny deployment.
According to Outlook I'm supposed to use:
Server name: smtp.office365.com
Port: 587
Encryption method: STARTTLS
But I can't seem to find a package that can do STARTTLS encryption. For other mail providers I see the advice to turn on "less secure apps" but that's not an option for us.
Example code :
library(mailR)
send.mail(from = "Me#companydomain.com",
to = c("you#companydomain.com"),
subject = "Test",
body = "TEST",
smtp = list(host.name = "smtp.office365.com",
port = 587,
user.name = "Me#companydomain.com",
passwd = "SuperSecretPassword",
tls = TRUE),
authenticate = TRUE,
send = TRUE,
debug = TRUE)
# Another option, with emayili:
library(emayili)
smtp <- server(host = "smtp.office365.com",
port = 587,
username = "Me#companydomain.com",
password = "SuperSecretPassword")
email <- envelope(from = "Me#companydomain.com",
to = "you#companydomain.com",
subject = "This is a plain text message!",
text = "Hello!")
smtp(email, verbose = TRUE)
I really hope someone figured out a package that can use STARTTLS or how to encrypt in that way using one of these packages!
Best Regards,
Bob
I'm trying to send emails from R using sendmailR package using the following code, which unfortunately fails :
## Set mail contents
from <- sprintf('<sendmailR#%s>', Sys.info()[4])
to <- '<slackline#gmail.com>'
subject <- 'Feeding Plots'
body <- list('Latest feeding graph', mime_part(feeding.plot,
name = "feeding"))
## Set control parameters
control <- sendmail_options(verboseShow = TRUE,
smtpServer ="smtp.gmail.com",
smtpPort = 587,
smtpSTARTTLS = '',
blocking = FALSE)
sendmail(from,
to,
subject,
msg = body,
control = control,
headers)
<< 220 mx.google.com ESMTP xt1sm884721wjb.17 - gsmtp
>> HELO kimura
<< 250 mx.google.com at your service
>> MAIL FROM: <sendmailR#kimura>
<< 530 5.7.0 Must issue a STARTTLS command first. xt1sm884721wjb.17 - gsmtp
Error in wait_for(code) :
SMTP Error: 5.7.0 Must issue a STARTTLS command first. xt1sm884721wjb.17 - gsmtp
The sendmailR manual doesn't mention how to configures STARTTLS although it does indicate that additional arguments can be passed, which is why I have included the option smtpSTARTLS = '' based on whats mentioned in some other threads (here and here). I've tried playing with the argument for smtpSTARTTLS and setting it to TRUE but no joy.
Any pointers to documentation or solutions would be most welcome.
Thanks
As far as I understand it, sendmailR doesn't support any type of login to the SMTP server, hence, gmail is basically unusable. You can only use the package if you are within the right network and set up a server that is only reachable within the network I guess (i.e., one NOT using authentication).
The alternative is the mail package (in which you cannot use your own address).
The reference from the sendmailR documentation is:
SMTP AUTH is currently unsupported.
You could give the new mailR package a shot that allows SMTP authorization: http://cran.r-project.org/web/packages/mailR/index.html
The following call should then work:
send.mail(from = "slackline#gmail.com",
to = "slackline#gmail.com",
subject = "Subject of the email",
body = "Body of the email",
smtp = list(host.name = "smtp.gmail.com", port = 465, user.name = "slackline", passwd = "PASSWORD", ssl = TRUE),
authenticate = TRUE,
send = TRUE)
I am attempting to use the SendMailR function, I have checked with our I.T. department that I am using the correct server and I have the right permissions to connect and they have sent emails via this server but not through R and I have also checked that the port should be 25.
The code:
# E-Mail #
library(sendmailR)
from <- "david#work.com"
to <- "adam#work.com"
subject <- "Send Mail R- Test"
body <- "TESTING TESTING TESTING"
mailControl=list(smtpServer="uksmtp.global.local")
sendmail(from=from,to=to,subject=subject,msg=body,control=mailControl)
I receive the below error:
function (host = "localhost", port, server = FALSE, blocking = FALSE,
open = "a+", encoding = getOption("encoding"), timeout = getOption("timeout"))
.Internal(socketConnection(host, port, server, blocking, open,
encoding, timeout))
<bytecode: 0x00000000071beb18>
<environment: namespace:base>
So I figured its an error with or I needed to define a new socket connection, is this where the problem lies? Could anyone give me any pointers on where to go next with this to get it working?
Thanks in advance
Although this is not an answer to your question you might want to alternatively check out the mail package which offers an alternative way to sent mail via an external mail server and address:
require(mail)
sendmail("adam#work.com", "Send Mail R- Test", "TESTING TESTING TESTING")
Note that you can only sent 20 mails that way per day (to avoid spam).
You could give the new mailR package a shot that allows SMTP authorization: http://cran.r-project.org/web/packages/mailR
The following call should then work:
send.mail(from = "sender#gmail.com",
to = "recipient#gmail.com",
subject = "Subject of the email",
body = "Body of the email",
smtp = list(host.name = "smtp.gmail.com", port = 465, user.name = "recipient", passwd = "PASSWORD", ssl = TRUE, tls = TRUE),
authenticate = TRUE,
send = TRUE)
Just replace the key-value pairs in the parameter smtp and you should be set to go.
//Create Mail Message Object with content that you want to send with mail.
System.Net.Mail.MailMessage MyMailMessage = new System.Net.Mail.MailMessage("dotnetguts#gmail.com", "myfriend#yahoo.com",
"This is the mail subject", "Just wanted to say Hello");
MyMailMessage.IsBodyHtml = false;
//Proper Authentication Details need to be passed when sending email from gmail
System.Net.NetworkCredential mailAuthentication = new
System.Net.NetworkCredential("dotnetguts#gmail.com", "myPassword");
//Smtp Mail server of Gmail is "smpt.gmail.com" and it uses port no. 587
//For different server like yahoo this details changes and you can
//get it from respective server.
System.Net.Mail.SmtpClient mailClient = new System.Net.Mail.SmtpClient("smtp.gmail.com", 587);
//Enable SSL
mailClient.EnableSsl = true;
mailClient.UseDefaultCredentials = false;
mailClient.Credentials = mailAuthentication;
mailClient.Send(MyMailMessage);
Thats my code & it throws error :
No connection could be made because the target machine actively refused it 72.14.213.109:587
Code Reference : here
Please tell me how can i sought it out ??
Check both of the following points
1- Check that this port 587 is open on your machine
2- Check if your antivirus is blocking the connection to your port
Regards.
If your have any antivirus software running, check the access protection, unblock "prevent mass mailing worms from send mail"
Did you actually change the username and password?
I have a function that uses CDO to send emails with request to have a delivery receipt when the mail reacehes the recepient.
I use the following code:
CDO.Message msg = new CDO.Message();
CDO.Configuration conf = new CDO.Configuration();
conf.Fields["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"].Value = 1;
conf.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserver"].Value = txtHost.Text;
conf.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserverport"].Value = 25;
conf.Fields["http://schemas.microsoft.com/cdo/configuration/sendpassword"].Value = txtPass.Text;
conf.Fields["http://schemas.microsoft.com/cdo/configuration/sendusername"].Value = txtUser.Text;
conf.Fields.Update();
msg.Configuration = conf;
msg.To = txtTo.Text;
msg.From = txtFrom.Text;
msg.Subject = txtSubject.Text+" " + DateTime.Now;
msg.HTMLBody = txtBody.Text;
msg.BodyPart.Charset = "utf-8";
msg.DSNOptions = CdoDSNOptions.cdoDSNSuccessFailOrDelay;
msg.Fields.Update();
msg.Send();
Now this works fine on my local machine with my web server, but when used in the production server with another mail server the delivery receipts were not received.
I believe there must be a difference between my mail server and the production mail server but I don't know what it can be exactly.
So please if anybody has faced such a problem before, tell me what to do.
It works on your local machine almost by accident because you're delivering it to yourself. To work out in the world you have to explicitly tell CDO not to deliver to the local smtp for relaying by specifying sendUsingPort
conf.Fields["ttp://schemas.microsoft.com/cdo/configuration/sendusing"].Value = 2