Skip to content

Godot Engine 4.x addon to send emails through an SMTP server in a non-blocking way.

License

Notifications You must be signed in to change notification settings

fenix-hub/gdMail

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gdMail

Godot Engine 4.x addon to send emails through an SMTP server in a non-blocking way.

example usage

extends Control

# Called when the node enters the scene tree for the first time.
func _ready():
    
    # Create an SMTPAuthentication (if needed)
    var authentication: SMTPAuthentication = SMTPAuthentication.new(
        "<[email protected]>", "<your_password>"
    )
    
    # Create and instantiate the SMTPClient (example google -> host: "smtp.google.com" port: 587)
    var smtp_client: SMTPClient = SMTPClient.new("<smtp.provider.com>", <smtp_port>, true, authentication)
    add_child(smtp_client)
    
    # Create an Email
    var email: Email = Email.new(
        # Internet Address of the sender
        InternetAddress.new("<[email protected]>", "<a_name>"),
        # List of internet addresses of recipients
        [InternetAddress.new("<[email protected]>")],    
        # Subject                                 
        "Hello world!",
        # Body
        "Hello world! This is my first email ever from Godot. Hope you like it!"
    )
    
    # Send the email, the main thread won't be blocked
    smtp_client.send_email(email)
    
    # Await for the `result` signal, it returns a Dictionary
    var result: Dictionary = await smtp_client.result
    if result.success:
        print("Email sent!")
    else:
        print("Could not send email ", result.error)

Signals

  • result(Dictionary: { success: bool, error: Dictionary })
  • email_sent()
  • error(Dictionary: { error: String, code: int })

About

Godot Engine 4.x addon to send emails through an SMTP server in a non-blocking way.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published