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) 21 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.