mail can't send messages: Process exited with a non-zero status

I wrote a bash script that sends out a mail, but after 50 e-mails it starts to say "mail can't send messages: Process exited with a non-zero status". Can anyone help solve my problem. The code I used is below if you want to take a look at it.

#!/bin/bash #Declare variables area. emailBody=email_body.txt; #you have to use without “ symbol for some reason emailList=email_list_delimiter.txt; #send mail command. using a read file loop. while IFS= read -r emailTo; do cat $emailBody | mail -s "Hi, I'm looking for a position in IT Field." $emailTo | echo “Success”; done < <(grep . $emailList) 
2

1 Answer

You are probably hitting a server-side limit on the number of messages you can send in a fixed time, or equivalently the number of connections allowed within a moving window of time.

If you can (the message is not "personalized") it is best to send one message to multiple recipients, rather than many messages, each to one recipient. Do that by perhaps putting your own e-mail address in the To field, and then Bccing the whole of the list of recipients in one go. You'll have to check your mail command for how to do that.

3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like