Action

Email to myself

Posted by agiletortoise, Last update over 5 years ago

Use this action to send the current draft as a background email, using the first line as the subject and remain text as the body of the email.

The first time this action is run, it will prompt you to enter the target email address for the action, which will be stored for use later as a Credential value. To change the email used by the action, visit Settings > Credentials in Drafts, and “Forget” the “Email to myself” credential which stores the address. The next time the action is run, it will prompt again for a new email address.

Steps

  • script

    // Create identifier
    // To create variants of this action which use other email addresses
    // duplicate the action and change this identifier
    let credentialIdentifier = "Email to myself";
    
    // create credential to prompt for and store the email address. 
    let credential = Credential.create(credentialIdentifier, "Enter the email you wish the \"Email to myself\" action to send to below. You will only be asked the first time you run this action.");
    
    credential.addTextField("email", "Your email");
    
    // prompt to email if necessary...
    credential.authorize();
    
    // setup tag to use in Mail step...
    draft.setTemplateTag("email", credential.getValue("email"));
    
  • mail

    toRecipients
    [[email]]
    ccRecipients
    bccRecipients
    subjectTemplate
    [[title]]
    bodyTemplate
    [[body]]
    sendAsHTML
    false
    sendInBackground
    true

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.