Mutt - Silently failing to send email from bash script from CI/CD pipeline
by jaysand from LinuxQuestions.org on (#6CDQS)
Hi,
In my Azure ci/cd pipeline, I am executing tests on Ubuntu 20.04. At the end of the test, I created task in the azure pipeline , to send an email to team with attachment of test reports.
I am using bash script in the azure task. Here is the code:
Code:echo "line1"
sudo apt install mailutils
echo "line2"
sudo apt install mutt
echo "line3"
echo -e "Test Message" | mutt -s "[E2E ]TestReport - Test Status" -- myemail@org.comNow this one works once in a while. I receive an email in my mailbox with the From Name as vsts@fv-az355-724.norxwxgvcn4uzhpoax...l.cloudapp.net
Each time this email address is different.
I believe since my task is part of ci/cd pipeline, Each time deployment happens , this email is going to be auto-generated. My organization email system is somehow treating it as junk and not letting it enter everytime.
How do I solve this?
I also tried by editing the ~/.muttrc file and setting the hostname . Again it sent an email from that hostname only once and then it stopped. There are no errors or failures.
How do I solve this ?
Post Edit: while going through the logs, I came across following in the logs. The log is very long but this seems important. Mailutils is also installing postfix on its own.
Quote:
Is there a way I can change the myhostname and destinations in postfix so that my organization email does not treat this email id as spam and reject it silently?
In my Azure ci/cd pipeline, I am executing tests on Ubuntu 20.04. At the end of the test, I created task in the azure pipeline , to send an email to team with attachment of test reports.
I am using bash script in the azure task. Here is the code:
Code:echo "line1"
sudo apt install mailutils
echo "line2"
sudo apt install mutt
echo "line3"
echo -e "Test Message" | mutt -s "[E2E ]TestReport - Test Status" -- myemail@org.comNow this one works once in a while. I receive an email in my mailbox with the From Name as vsts@fv-az355-724.norxwxgvcn4uzhpoax...l.cloudapp.net
Each time this email address is different.
I believe since my task is part of ci/cd pipeline, Each time deployment happens , this email is going to be auto-generated. My organization email system is somehow treating it as junk and not letting it enter everytime.
How do I solve this?
I also tried by editing the ~/.muttrc file and setting the hostname . Again it sent an email from that hostname only once and then it stopped. There are no errors or failures.
How do I solve this ?
Post Edit: while going through the logs, I came across following in the logs. The log is very long but this seems important. Mailutils is also installing postfix on its own.
Quote:
Creating /etc/postfix/dynamicmaps.cf Adding group `postdrop' (GID 129) ... Done. setting myhostname: fv-az356-758.todi3lz1wlfenaxowbnpzhq2oe.fx.internal.cloudapp.net setting alias maps setting alias database changing /etc/mailname to fv-az356-758.todi3lz1wlfenaxowbnpzhq2oe.fx.internal.cloudapp.net setting myorigin setting destinations: $myhostname, fv-az356-758.todi3lz1wlfenaxowbnpzhq2oe.fx.internal.cloudapp.net, localhost.todi3lz1wlfenaxowbnpzhq2oe.fx.internal.cloudapp.net, , localhost setting relayhost: setting mynetworks: 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 setting mailbox_size_limit: 0 setting recipient_delimiter: + setting inet_interfaces: all setting inet_protocols: all /etc/aliases does not exist, creating it. WARNING: /etc/aliases exists, but does not have a root alias. |