Split out sending and printing of email data structure.
This commit is contained in:
		
							parent
							
								
									852f1eac5a
								
							
						
					
					
						commit
						264925b319
					
				
					 1 changed files with 11 additions and 7 deletions
				
			
		|  | @ -79,7 +79,7 @@ | |||
|       (body . ,(reminder-email-body mr))))) | ||||
| 
 | ||||
|  ;; Prints email to the console | ||||
|  (define (print-reminder-email em) | ||||
|  (define (print-notification-email em) | ||||
|    (print "### From: " (ldict-ref em 'from "-")) | ||||
|    (print "### To: " (ldict-ref em 'to)) | ||||
|    (print "### Subject: " (ldict-ref em 'subject)) | ||||
|  | @ -88,18 +88,22 @@ | |||
|        (print (car lines)) | ||||
|        (loop (cdr lines))))) | ||||
| 
 | ||||
|  ;; Sends notification email - the dictionary representation | ||||
|  (define (send-notification-email em) | ||||
|    (print "Sending " (ldict-ref em 'subject) " originally to " (ldict-ref em 'to)) | ||||
|    (send-mail (ldict-ref em 'body) | ||||
| 	      #:from (*email-from*) | ||||
| 	      #:to (ldict-ref em 'to) | ||||
| 	      #:subject (ldict-ref em 'subject))) | ||||
| 
 | ||||
|  ;; Creates and prints reminder email for given member record | ||||
|  (define (make+print-reminder-email mr) | ||||
|    (print-reminder-email | ||||
|    (print-notification-email | ||||
|     (make-reminder-email mr))) | ||||
| 
 | ||||
|  ;; Actually send emails | ||||
|  (define (make+send-reminder-email mr) | ||||
|    (let ((em (make-reminder-email mr))) | ||||
|      (print "Sending " (ldict-ref em 'subject) " originally to " (ldict-ref em 'to)) | ||||
|      (send-mail (ldict-ref em 'body) | ||||
| 		#:from (*email-from*) | ||||
| 		#:to "joe@joe.cz" | ||||
| 		#:subject (ldict-ref em 'subject)))) | ||||
|      (send-notification-email em))) | ||||
| 
 | ||||
|  ) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue