Sort of outbound email accounts

I have more than one outbound email accounts. It doesn’t sorted out alphabetically. How can i sort them?

And also there is no option “none” in drop down menu to selected default.

Hey,

Are you still encountering this?

Ive had a look into the code and it seems that both issues with “Outgoing Email Account” are due to the section starting at:
/modules/Campaigns/WizardMarketing.php, Line ~272

It appears to just grab the list of Outbound Email accounts, with no sorting.
And, as there will always be at least a “System” email, there is no “–none–” option as a default

Although, if you do wish to sort the Dropdown, as it is an array, you should just be able to customise campaigns and add an “asort()” function


So, if you copy the file at:
/modules/Campaigns/WizardMarketing.php

and create a new file at:
custom/modules/Campaigns/WizardMarketing.php
Paste the contents of the original WizardMarketing.php, into this new file

Then, in the new file, you can add an “asort()” function beneath the foreach, like so:

(This should sort the Email Inbox names, while keeping the associated IDs)

Then, after a Quick Repair and Rebuild in Admin->Repair, you should be able to see the “Outgoing Email account” values sorted alphabetically

I’ve given it a very brief check and the Campaign functionality seems to work with this addition, so it should be safe to add.
(Though I haven’t done thorough testing, so let me know if you encounter any issues with


2 Likes

Hi, thank you for your help. It is really short and good solution.
Can i do it for inbound list?
And also can i make outbound account default selection?

Hey,

Sorry, not 100% sure what field you mean by “inbound list”, is this on any particular view?
(or is this for the “Bounce Handling Account” value in the screenshots above?)

Also, i’m not sure what you mean by making an “outbound account default selection”
Do you mean to add “–none–” to this field?
Or force a specific account as the default?

Both of these may be a little harder, and I’m not too sure how to go about implementing those at the moment

Unless you were looking for something else?

I want to sort also inbound list.
I mean add “–none–” to this field or force a specific account as the default.

Thank you.

Hey,

I’m not sure how you would go about forcing a default option, but you should be able to add a --none-- option fairly easily by modifying the above code and adding a snippet like:
image

This would add a prepend a “–None–” value at the beginning of the array, showing it on the Wizard
(Though i’ve not fully tested to see if it affects Campaign functionality, I think it should be fine)

By “Inbound list”, which field do you mean?
Is this the “Bounce Handling Account” field in the screenshot you posted initially?

Hello,

Thank you for your help.

Outbound “–None–” option is ok. But it doesn’t comes selected :frowning: like Bounce Handling Account.
image

I’m talking about Bounce Handling Account field. It doesn’t sorted out like Outgoing Email Account.

Hi,

The “outgoing Email Account” should default to --none-- for new Campaigns, as it should be the first option now, but it won’t affect already existing campaigns.

Are you seeing this on a new campaign?


As for sorting the “Bounce Handling Account” field, it isn’t sorting because we haven’t added any code for it, the above snippets only affect the “Outgoing Email Account”

However, You should be able to add another “asort xxxx” function to change this:

If you add asort($mailboxes); to roughly line 252 in the same file,
(Between the lines in the screenshot below)

Then after a Repair and Rebuild, the Bounce Handling Account should sort Alphabetically

Let us know how you get on!

Thank you for your support. All is working good .
You are great.

1 Like