Title: gr1ns's Replies | WordPress.org

---

# gr1ns

  [  ](https://wordpress.org/support/users/gr1ns/)

 *   [Profile](https://wordpress.org/support/users/gr1ns/)
 *   [Topics Started](https://wordpress.org/support/users/gr1ns/topics/)
 *   [Replies Created](https://wordpress.org/support/users/gr1ns/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/gr1ns/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/gr1ns/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/gr1ns/engagements/)
 *   [Favorites](https://wordpress.org/support/users/gr1ns/favorites/)

 Search replies:

## Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Solid Mail – SMTP email and logging made by SolidWP] Customizing the “From” Email Address in Solid Mail Plugin](https://wordpress.org/support/topic/customizing-the-from-email-address-in-solid-mail-plugin/)
 *  Thread Starter [gr1ns](https://wordpress.org/support/users/gr1ns/)
 * (@gr1ns)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/customizing-the-from-email-address-in-solid-mail-plugin/#post-18231582)
 * Hi [@hoang](https://wordpress.org/support/users/hoang/),
 * I hope this message finds you well.
 * I wanted to follow up on my previous email regarding the JSON parsing issue I
   encountered while implementing the revised code snippet you provided. As a reminder,
   the error I’m facing is:
   `SyntaxError: JSON.parse: unexpected non-whitespace 
   character after JSON data at line 1 column 5 of the JSON data`
 * Could you please update me on any progress or suggestions for troubleshooting
   this issue? Your assistance in resolving this matter would be greatly appreciated.
 * Thank you in advance for your support. I look forward to hearing from you soon.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Solid Mail – SMTP email and logging made by SolidWP] Customizing the “From” Email Address in Solid Mail Plugin](https://wordpress.org/support/topic/customizing-the-from-email-address-in-solid-mail-plugin/)
 *  Thread Starter [gr1ns](https://wordpress.org/support/users/gr1ns/)
 * (@gr1ns)
 * [1 year, 7 months ago](https://wordpress.org/support/topic/customizing-the-from-email-address-in-solid-mail-plugin/#post-18186460)
 * Hi [@hoang](https://wordpress.org/support/users/hoang/),
 * Thank you for your updated response and the revised code snippet. Unfortunately,
   after implementing the provided code, I still encounter an issue. Specifically,
   I receive the following error:
   `SyntaxError: JSON.parse: unexpected non-whitespace
   character after JSON data at line 1 column 5 of the JSON data`
 * This error suggests there might be an issue with the data being processed or 
   returned within the email configuration or a related process. It’s unclear to
   me if this is directly tied to the `phpmailer_init` implementation or if there’s
   an issue elsewhere (e.g., in how the response or data is handled).
 * Could you kindly assist in troubleshooting this error further? Are there additional
   steps I should take to validate the setup, or is there a way to ensure the returned
   data is correctly formatted?
 * Looking forward to your guidance.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Solid Mail – SMTP email and logging made by SolidWP] Customizing the “From” Email Address in Solid Mail Plugin](https://wordpress.org/support/topic/customizing-the-from-email-address-in-solid-mail-plugin/)
 *  Thread Starter [gr1ns](https://wordpress.org/support/users/gr1ns/)
 * (@gr1ns)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/customizing-the-from-email-address-in-solid-mail-plugin/#post-18150828)
 * Hi,
 * Thank you for your response and the provided code snippet.
 * I’ve tested the provided solution in my theme’s `functions.php` file, but I encountered
   an error related to the usage of `$this` in the context of the `phpmailer_init`
   action. Since the code snippet is a standalone function and not part of a class,`
   $this` is unavailable, which results in the following error:
 *     ```wp-block-code
       Uncaught Error: Using $this when not in object context in /path-to-theme/functions.php:55Stack trace:#0 /wp-includes/class-wp-hook.php(324): {closure}()#1 /wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()#2 /wp-includes/plugin.php(565): WP_Hook->do_action()#3 /wp-includes/pluggable.php(540): do_action_ref_array()#4 /wp-content/plugins/ninja-forms/includes/Actions/Email.php(108): wp_mail()
       ```
   
 * This error occurs because `$this->providers_repository` cannot be used unless
   the function is part of a class.
 * Can you confirm if the `providers_repository` should be passed as a global object
   or instantiated directly in the snippet? Alternatively, should the snippet be
   integrated into a class with the `$this` context?
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Solid Mail – SMTP email and logging made by SolidWP] Customizing the “From” Email Address in Solid Mail Plugin](https://wordpress.org/support/topic/customizing-the-from-email-address-in-solid-mail-plugin/)
 *  Thread Starter [gr1ns](https://wordpress.org/support/users/gr1ns/)
 * (@gr1ns)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/customizing-the-from-email-address-in-solid-mail-plugin/#post-18104979)
 * Hi Hoang,
 * Thank you for the code snippet. However, I’m looking to dynamically set the “
   From” email address to match the email address that users enter in the form, 
   rather than using a fixed address.
 * Specifically, I want each email sent to have the “From” address populated with
   the user’s email from the form submission, so the recipient can see it as the
   sender’s address. Could you provide guidance on how to implement this?
 * Thank you for your help and clarification.

Viewing 4 replies - 1 through 4 (of 4 total)