• Instructions to Ask a Question

    For any assistance, please click the "Ask a Question" button and select the Pabbly product for which you require support.

    We offer seven comprehensive applications designed to help you efficiently manage and grow your business:

    Our support team endeavors to respond within 24 business hours (Monday to Friday, 10:00 AM to 6:00 PM IST). We appreciate your understanding and patience.

    🚀 Exclusive Lifetime Offers 🚀

    We invite you to take advantage of our special one-time payment plans, providing lifetime access to select applications:

    • 🔥 Pabbly Connect — Lifetime Access for $249View Offer
    • 🔥 Pabbly Subscription Billing — Lifetime Access for $249View Offer
    • 🔥 Pabbly Chatflow — Lifetime Access for $249View Offer

    Make a one-time investment and enjoy the advantages of robust business management tools for years to come.

Connect is setup for Multiple emails for Microsoft 365 but it's not working as intended

Your Workflow URL
https://connect.pabbly.com/workflow/share/CEBSYFIFB2RWHARuAVJUcw8bVlJXDlExVUwAEgMMUChSH1MGVxZdNwBMV3VQC1MyAksEblQIUWsLH1VRAFYCcQAOUkBUV1ErWxYCMVAZXW4IVlJ6UjM#
Your Task History ID
IjU3NjUwNTZiMDYzMTA0MzY1MjZjNTUzZDUxM2Ii_pc#
Consent to Access & Modify
I authorize Pabbly Support to log in to my account and make changes to the specified workflow for troubleshooting.
Last week you helped me get the workflow correct for doing a delay for Microsoft 365 emails. However, now that it is set up for multiples it seems to be having an issue when only one email address is present. I have attached a screen shot of the error message. I need it to work whether there is 1 or more email addresses.

Screenshot 2025-11-10 110649.png

Screenshot 2025-11-10 110627.png
 

Preeti Paryani

Well-known member
Staff member
Hello @perfectportals,

Thank you for reaching out to us.

As per your current setup, the configuration is static — the system doesn’t differentiate whether one or multiple email addresses are received from the trigger. To handle both cases dynamically, we recommend adding an OpenAI step. Pass the email string to OpenAI and instruct it to extract and format the emails as required for the Microsoft 365 action (as explained in the help text).

This will allow the workflow to function correctly whether there is one or multiple email addresses. Please give it a try and let us know how it goes.
 

Preeti Paryani

Well-known member
Staff member
Hello @perfectportals,

You can add the OpenAI step immediately after the email parser step in your workflow. In this step, use the subject or text field that contains the email addresses as the input.

1762927531279.png


In the OpenAI configuration, instruct it to extract and return only the email addresses in the same format required by the Microsoft 365 – Send Multiple Emails action. You may refer to the task images for a better understanding of the setup.

1762927547501.png


For this, you can use:
OpenAI (ChatGPT, DALL-E, Whisper): Generate Response Using Text Input (Response API)

1762927554806.png


Once configured, this will ensure your workflow works correctly for both single and multiple email addresses.
 

ArshilAhmad

Well-known member
Staff member
We have added a Python Code step to your workflow that will help extract email addresses from the subject of your email, convert them into the correct format, and pass them to the MS Office 365 action step. This will allow you to handle varying numbers of email addresses received in the trigger step. You don't need OpenAI action step in your workflow.
1762971384685.png



Python:
import re
import json

def extract_emails(text):
    # Regular expression to match valid email addresses
    email_pattern = r'[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}'
    
    # Find all email addresses in the input string
    emails = re.findall(email_pattern, text)
    
    # Convert to desired format
    formatted_emails = [
        {"emailAddress": {"address": email}} for email in emails
    ]
    
    # Convert list of dicts to comma-separated string
    result = ", ".join(json.dumps(item) for item in formatted_emails)
    
    return result


# Example usage
text = "Please contact us at [email protected], [email protected] or [email protected] for support."
print(extract_emails(text))

Thanks & Regards,
Arshil Ahmad
Customer Support Associate
🌐 Pabbly.com
👉Rate your support
 
Top