Snippets
Here's some of my tips, tweaks and tuts, ranging from PHP, Linux, MySQL and more!
Snippets / Plesk
Outgoing Mail Treated as "local" Plesk
So I originally came across this problem with a PLESK server I was maintaining. For this example we can call it domain.com. However, the MX records for domain.com are NOT set to the plesk server but to other external servers. (So there's no need for PLESK to handle mail) This domain.com's mail settings in PLESK were also disabled. If I tried to send a message to any *@domain.com email address, nobody would receive an email.
The Reason
I found out eventually that it was because PLESK was treating domain.com as local (internal mail routing) so I needed to stop this occuring.The solution
Edit the "locals" plesk file and then remove the domain.com reference.vim /var/qmail/control/locals
Persisting Problems?
If the above solution is not successful it's most probably worth checking the following files for domain.com references./var/qmail/control/virtualdomains /var/qmail/control/rcpthosts /var/qmail/control/smtproutes
12 years ago / Read More
Snippets / Plesk
Delete emails from email queue in PLESK
The GUI for PLESK's CMS is quite limited when you want to delete a large number of emails in one batch without crashing the website.
Through a linux command line you can filter and delete messages by either their email address, subject, from or to targets.
How to use qmHandle
qmHandle -h #################################################################### Available parameters: -a : try to send queued messages now (qmail must be running) -l : list message queues -L : list local message queue -R : list remote message queue -s : show some statistics -mN : display message number N -dN : delete message number N -fsender : delete message from sender -f're' : delete message from senders matching regular expression re -Stext : delete all messages that have/contain text as Subject -h're' : delete all messages with headers matching regular expression re (case insensitive) -b're' : delete all messages with body matching regular expression re (case insensitive) -H're' : delete all messages with headers matching regular expression re (case sensitive) -B're' : delete all messages with body matching regular expression re (case sensitive) -t're' : flag messages with recipients in regular expression 're' for earlier retry -D : delete all messages in the queue (local and remote) -V : print program version Additional (optional) parameters: -c : display colored output -N : list message numbers only (to be used either with -l, -L or -R)
Filter & Delete By Subject
qmHandle -S"Subject of Emails"
qmHandle Not installed?
There's a really helpful quick article about how to get this program working on your linux server - Support Facility Blog
13 years ago / Read More
Snippets / Plesk
Find PLESK email passwords
- Knowledge Needed: Plesk Parrallels, MySQL, Linux
- Snippet Length: 5 minutes
- Difficulty: Easy
It appears there is no incredibly obvious way inside PLESK to show email passwords. One way we can check is via MySQL
The database needed is "psa". Usually you won't have access to this database via PhpMyAdmin so you may need to login via ssh and access mysql directly.
Select the PLESK database
You will need a linux user account that will have access to view and select the psa table.
use psa;
Prepare the SELECT query
With the use of 2 "LEFT JOINS" we can get the information we need which are stored in 3 tables.
To make life a little easier a MySQL concatenation function will place the email user name and the domain together.
SELECT CONCAT(mail_name,"@",name) as email_address,accounts.password FROM mail LEFT JOIN domains on domains.id=mail.dom_id LEFT JOIN accounts on accounts.id=mail.account_id;
The Results
+------------------------------------+-----------+ | email_address | password | +------------------------------------+-----------+ | info@example.com | passhere | +------------------------------------+-----------+ 1 row in set (0.00 sec)
Alternative method...
Edit: After being informed there is an easier way to do this I thought I would share this as @Dataforce was kind enough to pass this on via twitter.
/usr/local/psa/admin/sbin/mail_auth_view
This even shows the status' of the email accounts
13 years ago / Read More