added sendmail.py example usage
This commit is contained in:
		
							parent
							
								
									badb46a595
								
							
						
					
					
						commit
						0d06aee062
					
				
							
								
								
									
										20
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								README.md
									
									
									
									
									
								
							| 
						 | 
					@ -102,7 +102,7 @@ ____
 | 
				
			||||||
|**[--file]**|mail attachment files|`None`|
 | 
					|**[--file]**|mail attachment files|`None`|
 | 
				
			||||||
|**[--time]**|minutes of attempts to send|3|
 | 
					|**[--time]**|minutes of attempts to send|3|
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Example usage in terminal:
 | 
					Example usage in terminal with make the script executable:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```bash
 | 
					```bash
 | 
				
			||||||
# download
 | 
					# download
 | 
				
			||||||
| 
						 | 
					@ -112,12 +112,24 @@ sudo chmod +x /usr/local/bin/sendmail.py
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```bash
 | 
					```bash
 | 
				
			||||||
# example 1
 | 
					# example 1
 | 
				
			||||||
sendmail.py -u user@gmail.com -p pass -d addr1@gmail.com,addr2@gmail.com
 | 
					sendmail.py -u user@gmail.com -p password -d addr1@gmail.com,addr2@gmail.com
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```bash
 | 
					```bash
 | 
				
			||||||
# example 2
 | 
					# example 2
 | 
				
			||||||
/usr/local/opt/python-3.9/bin/python3.9 /usr/local/bin/sendmail.py -u user@gmail.com -p pass -d addr1@gmail.com,addr2@gmail.com --file "/path/to/file1,/path/to/file2"
 | 
					/usr/local/opt/python-3.9/bin/python3.9 /usr/local/bin/sendmail.py -u user@gmail.com -p password -d addr1@gmail.com,addr2@gmail.com --file "/path/to/file1,/path/to/file2"
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Example usage in terminal without download:  
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```bash
 | 
				
			||||||
 | 
					python3 <(curl -s https://git.hmp.today/pavel.muhortov/utils/raw/branch/master/sendmail.py) \
 | 
				
			||||||
 | 
					    --user user@gmail.com \
 | 
				
			||||||
 | 
					    --pass password \
 | 
				
			||||||
 | 
					    --dest addr1@gmail.com,addr2@gmail.com \
 | 
				
			||||||
 | 
					    --subj "test subject" \
 | 
				
			||||||
 | 
					    --text "test body" \
 | 
				
			||||||
 | 
					    --file "/path/to/file1,/path/to/file2"
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Example usage in Python:
 | 
					Example usage in Python:
 | 
				
			||||||
| 
						 | 
					@ -125,7 +137,7 @@ Example usage in Python:
 | 
				
			||||||
```Python
 | 
					```Python
 | 
				
			||||||
from sendmail import Mail
 | 
					from sendmail import Mail
 | 
				
			||||||
 | 
					
 | 
				
			||||||
msg = Mail(smtp_user='user@gmail.com', smtp_pass='pass', mail_dest='addr1@gmail.com,addr2@gmail.com')
 | 
					msg = Mail(smtp_user='user@gmail.com', smtp_pass='password', mail_dest='addr1@gmail.com,addr2@gmail.com')
 | 
				
			||||||
log = msg.send()
 | 
					log = msg.send()
 | 
				
			||||||
print(log)
 | 
					print(log)
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user