Solved One more problem with the smtp of my ISP

Hi,

Referring to this post: https://forums.freebsd.org/threads/run-your-own-mail-server-by-m-w-lucas.93777/#post-658356

My ISP hardened once again its rules concerning the use of its smtp. So, my periodic mails aren't anymore delivered.
This time, it's the to: field that must either don't exist or be equal to the destination address of the mail.

I use mail/ssmtp as MTA and the mails periodic sent have the field to: root which is now rejected (exactly: accepted but never delivered). I didn't find a mean to modify this to: field.

So, my question is: is it possible to modify or delete this field with ssmtp or any specific periodic setting?
If not, what is the simplest MTA that allows this?
 
I use mail/ssmtp as MTA and the mails periodic sent have the field to: root which is now rejected (exactly: accepted but never delivered). I didn't find a mean to modify this to: field.
Have you tried setting root= in ssmtp.conf?

Code:
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
root=postmaster
 
I don't see how this can solve my problem...
You can create alias of the root which will forward all periodic e-mails to your e-mail. The configuration is done with build-in dma agent and i provided an example how to use smarthost with auth to send those e-mail.
 
looks that by default periodic will do its own mail to root and wont rely on cron settings (only if you set xxxx_output to an empty string)
see *_output in defaults/periodic.com
you may try to change the mail address
 
Have you tried setting root= in ssmtp.conf?

Code:
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
root=postmaster
No. The root parameter was set to my personal email address. Setting it to "postmaster" is explicitly rejected by my smtp. :'‑(
 
You can create alias of the root which will forward all periodic e-mails to your e-mail. The configuration is done with build-in dma agent and i provided an example how to use smarthost with auth to send those e-mail.
I have already in /usr/local/etc/ssmtp/revaliases:
root:"my email address":"my ISP smtp"

The problem isn't where the mail is sent but only in the to: field. I tried to change the root parameter in /etc/aliases to my personal email, but this has no effect.
 
looks that by default periodic will do its own mail to root and wont rely on cron settings (only if you set xxxx_output to an empty string)
see *_output in defaults/periodic.com
you may try to change the mail address
Alas... I was believing in this, but it doesn't work. If I put my email address in daily_output, the mail is still not received and if I put an empty string, the content of the daily mail is delivered to the console.
 
it wont display the output to console when run from cron
cron will mail output of run process to owner unless MAILTO is ""
 
it wont display the output to console when run from cron
cron will mail output of run process to owner unless MAILTO is ""
Not false, because I used periodic daily at the console to test, so that's not cron. I will let your settings this night. We will see.
 
Emrion

Hello, an idea:

Purchase an SMTP service with Amazon Web Services (AWS), it is called Simple Email Service (SES), it is cheap (US $1 /monthly for some 2000 mails by month)...

Validate your domain in AWS (I have used mydomain.com as an example, logically you should use your real domain)
Create Amazon SES SMTP credentials (something like: AKIA********* BGL4*********************************** )

Then you install the ssmtp package on your FreeBSD and configure it!


# pkg install ssmtp



# edit /etc/mail/mailer.conf


Code:
#sendmail       /usr/libexec/dma
#mailq          /usr/libexec/dma
#newaliases     /usr/libexec/dma

sendmail        /usr/local/sbin/ssmtp
mailq           /usr/local/sbin/ssmtp
newaliases      /usr/local/sbin/ssmtp


# edit /usr/local/etc/ssmtp/ssmtp.conf


Code:
Root=support@mydomain.com
MailHub=email-smtp.us-east-1.amazonaws.com:587
RewriteDomain=mydomain.com
Hostname=myservername.mydomain.com
AuthUser=AKIA*********
AuthPass=BGL4***********************************
UseSTARTTLS=YES
FromLineOverride=YES

Now test


# mail -v -s "Subject test" login@gmail.com


Code:
Hello
(Ctrl + D)

By script (in HTML with log file attached ;))


# edit /tmp/script.sh


Code:
#!/bin/sh

FROM='myservername@mydomain.com'
TO='login@gmail.com'
SUBJECT='Subject test'

PATH_BODY='/tmp'
BODY='body.html'
PATH_ATTACH_FILE='/tmp'
ATACH_FILE='log.txt'

cat <<MAIL | /usr/sbin/sendmail -t
From: $FROM
To: $TO
Subject: $SUBJECT
Mime-Version: 1.0
content-type: multipart/related; boundary=xBoundaryStringx

--xBoundaryStringx
Content-Type: text/html; charset=US-ASCII
Content-Disposition: inline

$(cat "${PATH_BODY}"/"${BODY}")

--xBoundaryStringx
Content-Type: text/plain; name=$ATACH_FILE
Content-Disposition: attachment; filename=$ATACH_FILE

$(cat "${PATH_ATTACH_FILE}"/"${ATACH_FILE}")

--xBoundaryStringx--
MAIL


# chmod +x /tmp/script.sh



# echo 'log content' > /tmp/log.txt



# edit /tmp/body.html


Code:
<p>Content body</p>
<p><a href="https://www.google.com">Visit Google</a></p>


# /tmp/script.sh


Your server can now send emails without problems and you can use those credentials on all your other servers!
 
it wont display the output to console when run from cron
cron will mail output of run process to owner unless MAILTO is ""
The mail was sent but never received. I suppose there was a to: root or something like that inside. So, this doesn't work.
 
Thanks for the idea, but paying even $1 to send about 40 mails a month is not in my plans, for the moment at least.

The worst is that I have a VM with debian and exim4 and I receive its mails, without peculiar configuration, just because it set to: to the destination mail address.
 
what happen when you try to send an e-mail via console?
If I use ssmtp in command line, the mail is successfully sent each time, but I receive it only, as I said, where there is no to: field or to: "MyEmailAddress". This is how I saw where the problem comes from.

For the moment, I redirected the periodic outputs in a file. At least, I can read them. I'm looking how to filter the sent mail to remove the to: field. Maybe there is a means with /etc/mail/mailer.conf using a script instead of direct ssmtp call.
 
Destination address field is mandatory. You have some other configuration issue. Are you trying to send the e-mails directly or via smart host with auth?
Is your P1 RCPT TO match the P2 TO: field?
 
Destination address field is mandatory. You have some other configuration issue. Are you trying to send the e-mails directly or via smart host with auth?
Is your P1 RCPT TO match the P2 TO: field?
I believe there is no configuration issue. I see in /var/log/maillog that the mail is sent without error. And it was working just some days before. The to: field isn't mandatory for my ISP, I tested it extensively.

For the rest, I'm not at all expert in mail things. Fact is periodic sends mails with to: root, and that the culprit.
 
Back
Top