if __name__ == '__main__': ## Setup and parse command line arguments parser = argparse.ArgumentParser(prog='pemail.py', description='Sends an email with an attachment.') parser.add_argument('-f', '--frm', default='[email protected]', help='The sender address.') parser.add_argument('-t', '--to', help='The recipient address.') parser.add_argument('-s', '--subject', help='The subject of the email.') parser.add_argument('-b', '--body', help='The body of the email.') ##parser.add_argument('-b', '--body', type=str, required=True) parser.add_argument('-a', '--attachment', help='The path to the attachment.') args=parser.parse_args() pemail(args)
hi Wavic
I am passing following command to the function
there is some issue passing parameter s_body="test kajdsfkj"
------------------
#!/bin/sh
s_email='[email protected]'
s_body="test kajdsfkj"
s_attachment='/tmp/test3.txt'
python pemail.py -t $s_email -s $s_subject -b $s_body -a $s_attachment > /home/xxx/mytest/logs/email.$(date +"%Y%m%d%H%M%S").log
User has been warned for this post. Reason: didnt use code tags directly after getting a warning