Action

TEMPLATE - Email multiple to Trello

Posted by Andrew Skotzko, Last update 7 days ago

UPDATES

7 days ago

Fixed description example

show all updates...

7 days ago

Fixed description example

7 days ago

Added icon

Email each line as a task to a Trello board. Optional task description per-line following a “|” character. Removes blank lines. Emails in background.

Example input:

Task 1 // description
Task 2

Task 3 // description here

Steps

  • script

    // Configuration - Set your Trello board's email address here
    const TRELLO_BOARD_EMAIL = "<board email here>";
    
    // Get the current draft's content
    let content = draft.content;
    
    // Split the content into lines
    let lines = content.split("\n").filter(line => line.trim()); // Remove empty lines
    
    // Process each line
    lines.forEach(line => {
        // Initialize variables for subject and body
        let subject, body;
        
        // Check if line contains the separator
        if (line.includes("//")) {
            let parts = line.split("//");
            subject = parts[0].trim();
            body = parts[1].trim();
        } else {
            subject = line.trim();
            body = " "; // Empty body if no separator found
        }
        
        // Create and configure the mail action
        let mail = Mail.create();
        mail.toRecipients = [TRELLO_BOARD_EMAIL];
        mail.subject = subject;
        mail.body = body;
        mail.sendInBackground = true;
        mail.send();
    });
    
    // Provide feedback
    if (lines.length > 0) {
        app.displayInfoMessage(`Sent ${lines.length} items to Trello`);
    } else {
        app.displayErrorMessage("No content found to send");
    }

Options

  • After Success Archive
    Notification Info
    Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.