Dropdown list for From line in Campaign

We have several people who access our phpList for sending out campaigns. In the “From line” on the campaign form is currently a general email address.

What we would like to be able to do is create a dropdown list for the campaign creator to select their email address and send the campaign out under the selected address.

Can this be done? If so how would I do it?

@philr phplist doesn’t support that and it isn’t a trivial change to make to the code.

If the admins are ordinary admins, not super admins, then using the USE_ADMIN_DETAILS_FOR_MESSAGES config setting will set the From field to the admin’s name and email address.

If the problem you have is that the admins are forgetting to change the From field then what you can do more easily is to validate that the admin has changed it to an acceptable value, such as it must include the admin’s email address. You can put the validation in a plugin file. Here is an example that validates that the field includes the admin’s email address (as held on the admin table).


<?php

class MyPlugin extends phplistPlugin
{
    /**
     * Validate that the campaign can be submitted.
     *
     * @param array $messageData
     *
     * @return string empty string for allow, otherwise error text to be displayed
     */
    public function allowMessageToBeQueued($messageData = array())
    {
        global $admin_auth;

        $from = $messageData['fromfield'];
        $adminAddress = $admin_auth->adminEmail($_SESSION['logindetails']['id']);

        if (strpos($from, $adminAddress) === false) {
            return "From address must include your email address \"$adminAddress\"";
        }

        return '';
    }
}