Skip to content

Shraddha Shahari - Fix the inability to send out emails from send emails tab#3148

Merged
one-community merged 3 commits into
developmentfrom
Shraddha-fix-send-out-emails-from-send-emails-tab
May 10, 2025
Merged

Shraddha Shahari - Fix the inability to send out emails from send emails tab#3148
one-community merged 3 commits into
developmentfrom
Shraddha-fix-send-out-emails-from-send-emails-tab

Conversation

@ShraddhaShahari
Copy link
Copy Markdown
Contributor

@ShraddhaShahari ShraddhaShahari commented Feb 11, 2025

Description

Shraddha fix send out emails from send emails tab: If user don't provide correct "request body" for example: does not upload a file, then the user request was failing with generic error "Error sending email" and 400 error code.
Added validation check for upload file before sending an email, if user don't upload a file it will show an error "Please upload a file" after uploading file it proceed with the request and will send email successfully.

Fixes #
Added validation check for "Upload Header (or footer)" field (file upload) before sending an email.

Related PRS (if any):

N/A

Main changes explained:

  • Created a state variable isFileUploaded with an initial value of false.
  • Updated isFileUploaded to true when an image is uploaded in addImageToEmailContent.
  • Checked isFileUploaded in handleSendEmails to ensure a file is uploaded before proceeding.

How to test:

  1. check into current branch
  2. do npm install and ... to run this PR locally
  3. Clear site data/cache
  4. log as owner user
  5. go to dashboard→ Other Links→ Send Emails
  6. verify if user just provides email address and don't upload any header(file), then it should show an error "Please upload a file."
  7. verify "Email successfully sent" message is shown only when user sends complete request. (i.e. comma separated email addresses, upload header: image_file)
  8. verify this new feature works in [dark mode]

Screenshots or videos of changes:

Screen recording:

Screen.Recording-PR3148.mov

Before fix error screenshot:
Before-fix-error

After fix correct error is shown:
After-fix-error

After-fix-success-email

Note:

Logged in user should have "Send email" permissions.
steps to check if user have permission or not:
1.Dashboard-> Other-Links-> Permissions Management
2.Select user role-> Announcement-> Send emails

@netlify
Copy link
Copy Markdown

netlify Bot commented Feb 11, 2025

Deploy Preview for highestgoodnetwork-dev ready!

Name Link
🔨 Latest commit ef90049
🔍 Latest deploy log https://app.netlify.com/sites/highestgoodnetwork-dev/deploys/67e71956e996e100084afdbd
😎 Deploy Preview https://deploy-preview-3148--highestgoodnetwork-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@ShraddhaShahari ShraddhaShahari added the High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible label Feb 11, 2025
Copy link
Copy Markdown
Contributor

@AurHubertMax AurHubertMax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could not find/recreate the Send Emails button as it does not show up for me. I accessed it using an admin account and I've re-fetched and installed all the dependencies in the branch multiple times as well. Is there something I'm missing?

2-Click.Screen.Recorder-20250211-180324.500.mp4

@ShraddhaShahari
Copy link
Copy Markdown
Contributor Author

AurHubertMax
Make sure the logged in user should have "Send email" permissions

@AurHubertMax
Copy link
Copy Markdown
Contributor

AurHubertMax Make sure the logged in user should have "Send email" permissions

I noticed that sending emails seems to work only for users with the owner role. I was logged in with an admin account, and when reviewing the announcement permissions, I saw that sending emails isn’t available for admins (as shown below).

Would it be possible to update step 4 in the description to reflect this? Thank you!

2-Click.Screen.Recorder-20250212-150642.499.mp4

Copy link
Copy Markdown

@Srichand-Medagani Srichand-Medagani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have logged in as owner and it shows "error! upload the image" but when I tried to sedn the email with an image and comma separated email addresses it shows "error sending email". Is there anything I am missing?
image
image

@ShraddhaShahari
Copy link
Copy Markdown
Contributor Author

ShraddhaShahari commented Feb 14, 2025

Srichand-Medagani, You can do inspect page and check what is the exact issue.
Check if "send email" request contains all the fields and nothing is missing.

(Also check screen recording I uploaded recently, in the description.)

AurHubertMax
AurHubertMax previously approved these changes Feb 15, 2025
Copy link
Copy Markdown
Contributor

@AurHubertMax AurHubertMax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Followed instructions, error showing as expected.
Summary of conditions tested:

  • Tried sending email without header
  • Tried sending email with header (results in server error, but is out of this fix's scope)
  • Checked payload to make sure all the data was correct
  • Tested sending email in development branch to confirm server error when sending email not only happens in this branch
2-Click.Screen.Recorder-20250214-194900.785.mp4

payload data:
Screenshot (24)

confirmed that the sending email server error persists in the development branch:

sc of sending email in dev branch

Copy link
Copy Markdown
Contributor

@jeyanthi-sm jeyanthi-sm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested the following functionalities:

Sending emails from the "Send Emails" tab.
When trying to send an email without specifying a sender, the correct error message is displayed.
Sending an email without attaching a file works fine.
However, it fails with the error message "Error sending email" when one or more email addresses are provided along with an uploaded file.
The "Send Email" functionality is available only for the Owner and not for the Admin user.

PR 3148

@saishekhar10
Copy link
Copy Markdown
Contributor

I've logged in as an owner user and tried to send emails without any attachment, the correct error message is displayed.
However, the same error message is displayed when I've uploaded an attachment and try to send it to one or more users.

3148Video.mov

@koushi1906
Copy link
Copy Markdown

Have tested the functionality.

Summary:

  1. Email Field Blank: An error occurred, as expected, when the email field was left empty.
  2. Header Field Empty: An error was triggered when the header was left blank, which seems to be a required field.
  3. Both Fields Populated: A server error occurred when both the email and header fields were populated, preventing the email from being sent.
Screenshot 2025-02-21 at 9 50 57 PM

@ShraddhaShahari
Copy link
Copy Markdown
Contributor Author

Tested the following functionalities:

Sending emails from the "Send Emails" tab. When trying to send an email without specifying a sender, the correct error message is displayed. Sending an email without attaching a file works fine. However, it fails with the error message "Error sending email" when one or more email addresses are provided along with an uploaded file. The "Send Email" functionality is available only for the Owner and not for the Admin user.

PR 3148

@jeyanthi-sm , Can you please add the exact error logs? so that I can look into it, because this issue is not related to my code changes. And this functionality is working fine at my end.

@ShraddhaShahari
Copy link
Copy Markdown
Contributor Author

Can you please add the exact error logs? so that I can look into it, because this issue is not related to my code changes. And this functionality is working fine at my end.

@koushi1906 , Can you please add the error logs? so that I can look into it, because this issue is not related to my code changes. And this functionality is working fine at my end.

@ShraddhaShahari ShraddhaShahari dismissed jeyanthi-sm’s stale review March 28, 2025 21:51

I looked in the code and the given functionality, the issue you said is not related to my code changes. And this functionality is working fine at my end.

Copy link
Copy Markdown

@humera314 humera314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is working as expected
image
image

Copy link
Copy Markdown
Contributor

@myeeli myeeli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have checked out the current PR. I have logged in as a owner user. when i'm trying to upload the file i'm getting error.

PR 3148 - 1 PR 3148 - 2

@ShraddhaShahari ShraddhaShahari changed the title Shraddha fix send out emails from send emails tab Fix the inability to send out emails from send emails tab May 9, 2025
@one-community one-community changed the title Fix the inability to send out emails from send emails tab Shraddha Shahari - Fix the inability to send out emails from send emails tab May 10, 2025
@one-community one-community merged commit f0b9a1f into development May 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible Urgent Priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants