Advertisement
martypete

Exim Test Email Script

Apr 25th, 2024 (edited)
642
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.76 KB | Cybersecurity | 0 0
  1. #!/bin/bash
  2.  
  3. # Prompt for the -f variable for the RFC5321.MailFrom
  4. read -e -p "RFC5321.MailFrom address: " smtp_mailfrom
  5.  
  6. # Prompt for the RFC5322.From field
  7. read -e -p "RFC5322.From address: " from_field
  8.  
  9. # Prompt for the RCPT TO field
  10. read -e -p "Enter RCPT TO adress: " to_field
  11.  
  12. # Prompt for the Subject
  13. read =e -p "Enter the Subject: " subject
  14.  
  15. # Prompt for the Body (terminate with a line containing only '.')
  16. echo "Enter the Body (terminate with a line containing only '.'): "
  17. body=""
  18. while IFS= read -r line
  19. do
  20.     if [ "$line" = "." ]; then
  21.         break
  22.     fi
  23.     body="$body$line\n"
  24. done
  25.  
  26. # Construct the email and send it using exim
  27. echo -e "From: $from_field\nTo: $to_field\nSubject: $subject\n\n$body" | exim -v -i -f "$smtp_mailfrom" -t
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement