• Resolved slamkajs

    (@slamkajs)


    I am currently trying to integrate the Post SMTP plugin for a service I manage which is connected to Mailgun email service. The purpose of our integration is to catch the emails as they are sent TO our mailgun domain (via Mailgun SMTP). We are using the incoming emails to track information, but to do so we use the FROM email address to tie the information to a user. I see the Sendinblue integration allows for this logic, but Mailgun does not.

    Am I incorrect about this? Within the code if I modify the $senderEmail for Mailgun to match the same as Sendinblue then it functions as I expect. The settings on the Message tab are “Prevent plugins and themes from changing this” are not checked so I should technically be able to overwrite these values.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Saad Iqbal

    (@saadiqbal)

    Hi @slamkajs ,

    Hope you are doing good. I’m not clear exactly what you are trying to achieve here, but one thing I would like to point out is that modifying plugin code carries some risk, and it’s essential to be cautious and well-informed when making such changes. Additionally, maintaining custom code may require ongoing effort to ensure compatibility with plugin updates and other system changes.

    If you only want to track the emails, you can simply use wp_mail_succeeded hook.

    Check the code reference.

    Best of luck with your discovery.

    Thanks!

    Thread Starter slamkajs

    (@slamkajs)

    im completely aware of the dangers involved in modifying the code. Even if the changes are valid, updating the plugin erases the change.

    The goal I am trying to accomplish does not involve monitoring if an email was sent, I have an external application which monitors incoming mall communications via Mailgun. The main issue I have is I want to be able to specify the FROM address. The Sendinblue engine already allows for the overwriting of the FROM email address, but Mailgun engine does not.

    Plugin Author Saad Iqbal

    (@saadiqbal)

    @slamkajs thanks for the details. Can you share the code which you are using to overwrite the From address? That might help me to understand what you are looking for.

    Thanks!

    Thread Starter slamkajs

    (@slamkajs)

    Here is the gist of my email generation.

    // SET EMAILS
    $from_email = $_POST["email"];
    $to_email = $_POST["toEmail"];
    
    $subject = "Contact Request from ...";
    $headers = ["From: " . $_POST["firstName"] . " " . $_POST["lastName"] . " <" . $from_email . ">"];
    
    $sent = wp_mail($to_email, $subject, "body content for email", $headers);

    I can see when debugging through the Mailgun engine that my header’s FROM email address and name are found. The issue is Mailgun’s engine does not give a condition to keep or overwrite the FROM email address. It implements the POST SMTP Mailer’s FROM email address every time. I am looking for it to check if a FROM email address already exists and if it does then it should NOT use the plugin’s FROM email address.

    Plugin Author Saad Iqbal

    (@saadiqbal)

    Thanks @slamkajs for providing the details. We may need to test this case and will see if we can add a patch for it. It might take a few weeks (if we deiced to update this in core). Anyways, will keep you updated with the progress.

    Till then you can manage it on your end as you have already discovered.

    Thanks!

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

The topic ‘Dynamic FROM email address’ is closed to new replies.