Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Email sender

This is a python lib to send mail. The mail can be generated by a llm with ollama or you can write it.

Prerequisites

You'll need:

  • linux (ubuntu works perfectly)
  • an email (gmail, it's only work on gmail for the moment)
  • application password (can be create in the gmail account)
  • python (works on 3.12.3)

Installation of the custom lib

pip install lau-project-mail

Utilisation

from lau-project-mail import Mail

variable = Mail(prompt, model)
# ....

Usage examples

Example 1: generating the mail

mail = Mail(prompt, model)

mail.set_context(prompt, subject)
mail.set_sender(sender, password)
mail.set_recipient(recipient)

mail.generate()

Example 2: manualy writing

mail = Mail(prompt, model)

mail.set_sender(sender, password)
mail.set_recipient(recipient)

mail.set_subject(subject)
mail.set_body(body)

Example 3: editing the subject or the body

The mail can be send, but after the preview, you want to edit the mail (body and/or subject)

mail = Mail(prompt, model)

# ... generated or wrote

mail.set_subject(subject)
mail.set_body(body)

The class

- The constructor

You'll need:

  • prompt: the prompt for the llm
  • model: the model of the llm
variable = Mail(prompt, model)

The sets methods

- Set recipient

You'll need:

  • recipient: the email to send the mail
variable.set_recipient(recipient)

- Set sender

You'll need:

  • sender: the email to send the mail
  • password: the application password
variable.set_sender(sender, password)

- Set context

You'll need:

  • context: approximatly the idea for the body
  • mail_subject: approximatly the idea for the subject
variable.set_context(context, mail_subject)

Generate ,preview and send methods

- Generate

You'll need:

  • use the set method to give to the variable the informations to generate the mail
variable.generate()

- Preview

You'll need:

  • use the genate method or use the set_subject and set_body methods if you don't want to generate
variable.preview()

- Send

You'll need:

  • use the genate method or use the set_subject and set_body methods if you don't want to generate
variable.send()

Other set methods

- Set body

You'll need:

  • body: the body of the mail
variable.set_body(body)

- Set subject

You'll need:

  • subject: the subject of the mail
variable.set_subject(subject)

Releases

Packages

Contributors

Languages