Publi

Crear múltiples direcciones de correo desde el CLI de Plesk

Muchos usuarios disponen de un panel de control Plesk. Que, aunque no es libre, hoy vamos a hablar de él. Dicho panel de control, proporciona una forma sencilla de gestionar dominios, páginas web y servicios asociados, como el correo, desde su interfaz web. Lo que puede que no sea tan conocido es que dispone de una serie de herramientas en línea de comandos que nos pueden hacer la vida mucho más fácil.

Para utilizar estos consejos, es necesario tener acceso SSH a nuestro servidor.

Crear una dirección de e-mail

Para crear una dirección de correo con su buzón y todo, podemos utilizar la siguiente orden:

plesk bin mail -c email@dominio

Podemos crear una dirección de correo para cualquier dominio que tengamos administrado en nuestro servidor. Y también podemos especificar algunos parámetros en su creación como:
  • -mailbox true: Para activar el buzón de correo.
  • -passwd [password]: Para especificar la contraseña.
  • -mbox_quota 5G: Para especificar el espacio del buzón de correo (5GB en el ejemplo).
  • -description «Descripción»: Para especificar una descripción que veremos en el panel Plesk.
  • -manage-virusfilter true: Para activar el filtro antivirus.
  • -manage-spamfilter true: Para activar el filtro antispam.
  • -antivirus inout: Para configurar antivirus tanto de entrada como de salida.
  • -outgoing-messages-mbox-limit 100: Para configurar el número de mensajes que pueden enviarse cada hora.

Hay alguna opción más dependiendo de la versión de Plesk, como especificar grupos de correo, alias, etc. Podemos obtener el listado completo de opciones con el argumento –help. Por lo que finalmente podemos tener algo como esto:

plesk bin mail -c yo@midominio.com -mailbox true -passwd ‘D[8NoBj#3f’ -mbox_quota 5G -description ‘Mail principal’ -outgoing-messages-mbox-limit 150

Puede parecer algo complicado, aunque lo realmente bueno viene dentro de algunas líneas.

Modificar o Eliminar correos

Desde aquí también podemos modificar direcciones de correo, con las mismas opciones que antes, pero con el argumento -u. Por ejemplo, para cambiar una contraseña podemos:

plesk bin mail -u yo@midominio.com -passwd ‘clavesencilla’

Y si finalmente queremos eliminar el correo,

plesk bin mail -r yo@midominio.com

Crear múltiples direcciones de correo

Si queremos crear múltiples direcciones de correo, y esto es lo bueno, no tenemos que andar con la interfaz web, dirección a dirección. Basta con crear un bucle en Bash y llamar a la orden anterior múltiples veces.
Esto puede pasar cuando necesitemos migrar direcciones de correo de un servidor a otro, puede que unas pocas direcciones sean fáciles de crear en la interfaz web, pero cuando hablamos de decenas, o cientos, nos compensa más invertir un poco de tiempo en un pequeño script y ejecutarlo, y las tendremos todas generadas.
Podemos hacerlo de forma muy sencilla, desde la propia línea de comandos:

1
2
3
for direccion in info persona1 persona2 persona3; do
  plesk bin mail -c $direccion@midominio.com -mbox_quota 5G -passwd 'ClaveFacil'
done

Con esto crearemos los e-mails info@midominio.com , persona1@midominio.com , persona2@midominio.com y persona3@midominio.com con la misma cuota de buzón de correo y la misma contraseña.

Aunque si queremos, podemos ir un paso más allá, creando un fichero de texto (direcciones.list) donde guardamos todos los nombres de usuario, uno por línea, pueden ser cientos o miles (ya será la capacidad de nuestro servidor el límite).

Tras eso creamos el siguiente script:

1
2
3
4
5
6
7
8
#!/bin/bash
while IFS= read -r line
do
  password=$(pwgen -1 -y 12)
  email="$line@midominio.com"
  plesk bin mail -c "$email" -mbox_quota 5G -passwd "$password" -mailbox true -antivirus inout
  echo "$email:$password" >> passwords
done < direcciones.list

De esta manera podremos configurar un montón de direcciones de correo con las mismas características. Incluso de dominios diferentes si introducimos el dominio en el archivo direcciones.list y lo eliminamos de la variable $email. Las contraseñas, como vemos, las genero con la herramienta pwgen, aunque también podemos dejarlas fijas o utilizar cualquier otro método de generación de contraseñas.

Por otro lado, si ahora queremos modificar la cuota de espacio en disco de múltiples correos a la vez podremos:

1
2
3
4
5
6
#!/bin/bash
while IFS= read -r line
do
  email="$line@midominio.com"
  plesk bin mail -u "$email" -mbox_quota 2G
done < direcciones.list

Incluso utilizar el modificador -r para eliminar varias direcciones de correo a la vez.

Por cierto, es buena idea, una vez que tengamos los correos generados en el sistema, guardar en lugar seguro el fichero de contraseñas, al menos hasta que hayamos asignado las contraseñas a cada uno de los usuarios y en ese momento eliminarlo permanentemente.

Foto principal: unsplash-logoCarol Jeng

Binarideas logo

¿Necesitas un sysadmin?

Si te ha gustado el post y encuentras interesante lo que cuento en materia de sistemas. O si necesitas gestionar un servidor (o muchos), automatizar procesos o mejorar la calidad de los procesos actuales. No dudes en ponerte en contacto conmigo.

También podría interesarte....

There are 66 comments left Ir a comentario

  1. mapquest directions /
    Usando Google Chrome Google Chrome 81.0.4044.113 en Windows Windows NT

    I appreciate your efforts in this sharing, can you let me talk directly with you?

  2. cumo /
    Usando Google Chrome Google Chrome 104.0.0.0 en Windows Windows NT

    The passwords, as we can see, are generated with the pwgen tool, although we can also leave them fixed or use any other password generation method. gmail

  3. Sarasota fence /
    Usando Google Chrome Google Chrome 104.0.0.0 en Windows Windows NT

    Very useful and informative website. fence companies sarasota

  4. Buy Deadhead Chemist DMT /
    Usando Google Chrome Google Chrome 104.0.0.0 en Windows Windows NT

    Beneficial article for beginners. I am a beginner too, so these tips help me a lot thanks for sharing. It’s helpful for this blog. Buy Deadhead Chemist DMT Also, great with all of the valuable information you have. Keep up the excellent work you are doing well.

  5. Organic Swedish Bitters /
    Usando Google Chrome Google Chrome 104.0.0.0 en Windows Windows NT

    I am really thankful to you for giving blog commenting sites Organic Swedish Bitters I will definitely be coming back here more often. Thanks for taking the time to share this fantastic post with us.

  6. Buy Google Review /
    Usando Google Chrome Google Chrome 104.0.0.0 en Windows Windows NT

    This is a great article thanks for sharing this informative information Buy Google Review I will visit your blog regularly for the latest post. I will visit your blog regularly for The newest post.

  7. Blue Bubba Strain /
    Usando Google Chrome Google Chrome 104.0.0.0 en Windows Windows NT

    Excellent to be visiting your blog again, it has been great for me. Rightly, this article that I’ve been served for therefore long. I want this article to finish my assignment within the Everyone. Blue Bubba Strain and it has the same topic together with your article. Thanks for the ton of valuable help, nice share.

  8. Gutter /
    Usando Google Chrome Google Chrome 104.0.0.0 en Windows Windows NT

    Plesk is a web hosting platform that includes a control panel that allows administrators to set up websites, reseller accounts, e-mail accounts, DNS, and databases via a web browser. Plesk has built-in support for Content Management Systems (CMS), such as WordPress, Joomla, and Drupal.

  9. Ed /
    Usando Google Chrome Google Chrome 104.0.0.0 en Windows Windows NT

    Thanks for this great content. Looking or more.
    fence company miami

  10. john /
    Usando Google Chrome Google Chrome 104.0.0.0 en Windows Windows NT

    Amazing information. Thank you for sharing…Concrete Contractors Maitland

  11. GLOCK 45 FOR SALE /
    Usando Google Chrome Google Chrome 104.0.0.0 en Windows Windows NT

    Beneficial article for beginners. I am a beginner too, so these tips help me a lot thanks for sharing. It’s helpful for this blog. GLOCK 45 FOR SALE Also, great with all of the valuable information you have. Keep up the excellent work you are doing well.

  12. mim /
    Usando Google Chrome Google Chrome 104.0.0.0 en Windows Windows NT

    Wow! Such an excellent and helpful post this is. I love it. It’s so good and so perfect.GLOCK 27 FOR SALE I am just amazed. I hope you continue to do your work like this in the future also, thanks.

  13. Ketof Cough Syrup /
    Usando Google Chrome Google Chrome 104.0.0.0 en Windows Windows NT

    Beneficial article for beginners. I am a beginner too, so these tips help me a lot thanks for sharing. It’s helpful for this blog. Ketof Cough Syrup Also, great with all of the valuable information you have. Keep up the excellent work you are doing well.

  14. enterprise website seo audit report /
    Usando Google Chrome Google Chrome 104.0.0.0 en Windows Windows NT

    Excellent to be revisiting your blog, it has been great for me. Rightly, this article that I’ve been served for therefore long. I want this article to finish my assignment within the Everyone. Blue Bubbaenterprise website SEO audit report Strain has the same topic together with your writing. Thanks for the ton of valuable help, nice share.

  15. Mary Solero /
    Usando Google Chrome Google Chrome 104.0.0.0 en Windows Windows NT

    The passwords, as we can see, are generated with the pwgen tool, although we can also leave them fixed or use any other password generation method. motorized awnings Pleasantville NJ

  16. Havalon REDI EDC Knife /
    Usando Google Chrome Google Chrome 104.0.0.0 en Windows Windows NT

    It is a great post. We’re new to blogging as our primary source of income has always been freelance software engineering. I will be taking a look Havalon REDI EDC Knife at some of these recommendations. Thanks for sharing!

  17. FN 502 For Sale /
    Usando Google Chrome Google Chrome 104.0.0.0 en Windows Windows NT

    It is a great post. We’re new to blogging as our primary source of income has always been freelance software engineering. I will be taking a look FN 502 For Sale at some of these recommendations. Thanks for sharing!

  18. wikifoundry top 100 /
    Usando Google Chrome Google Chrome 105.0.0.0 en Windows Windows NT

    The information on your blog is motivating to me. It conveys how thoroughly you understand this subject. Incredible that the arrival went well. Each of these tiny bits of information and data can be created using a wide variety of musical report practical experience.wikifoundry top 100

  19. Lea /
    Usando Google Chrome Google Chrome 104.0.0.0 en Windows Windows NT

    Great article! Unicorn pyjamas are really good!

  20. mim /
    Usando Google Chrome Google Chrome 104.0.0.0 en Windows Windows NT

    This is a great article thanks for sharing this informative information .Colt Anaconda For Sale I will visit your blog regularly for the latest post. I will visit your blog regularly for The newest post.

  21. mim /
    Usando Google Chrome Google Chrome 104.0.0.0 en Windows Windows NT

    Thanks, again for the tips, I always come to your website for updates and new posts. Since we work on search engine optimization, FN 5.7 For Sale it helps us a lot that it gives us so many opportunities in our line. And he gave us knowledge and points at the same time. I hope you’re on the right track.

  22. Targethandshooter /
    Usando Google Chrome Google Chrome 105.0.0.0 en Windows Windows NT

    This is a most informative article. I have read this article. Sig Sauer 228 For Sale I am sure that those who read this article will be learned a lot. Thanks for discussing this topic.

  23. cakecartsonline /
    Usando Google Chrome Google Chrome 105.0.0.0 en Windows Windows NT

    Really helpful and informative article. Buy Snowflake Cake Carts Online Thanks for sharing. Keep up the good work. Thanks for sharing.

  24. mim /
    Usando Google Chrome Google Chrome 104.0.0.0 en Windows Windows NT

    I am really thankful to you for giving blog commenting sites.Brand New Cake Bars I will definitely be coming back here more often. Thanks for taking the time to share this fantastic post with us.

  25. Purple Punch Cake Carts /
    Usando Google Chrome Google Chrome 105.0.0.0 en Windows Windows NT

    It is a great post. We’re new to blogging as our primary source of income has always been freelance software engineering. I will be taking a look Purple Punch Cake Carts at some of these recommendations. Thanks for sharing!

  26. www.cctv717.com /
    Usando Google Chrome Google Chrome 105.0.0.0 en Windows Windows NT

    Great work, Gaspar!

    All the best from all of us at http://www.cctv717.com

  27. Rose /
    Usando Google Chrome Google Chrome 105.0.0.0 en Windows Windows NT

    This is a great blog and I want to visit this every day of the week drywall plastering near me south lake tx

  28. Deutchland Pharmacy Europe /
    Usando Google Chrome Google Chrome 105.0.0.0 en Windows Windows NT

    Excellent to be revisiting your blog. It has been great for me. Rightly, this article that I’ve been served for therefore long. I want this article to finish my assignment within the Everyone. Deutchland Pharmacy Europe and it has the same topic together with your article. Thanks for the ton of valuable help, nice share.

  29. Preeti Saha /
    Usando Google Chrome Google Chrome 105.0.0.0 en Windows Windows NT

    Excellent to be visiting your blog again, it has been great for me. cheap windshield replacement in houston texas

  30. Annalee Porter /
    Usando Google Chrome Google Chrome 105.0.0.0 en Windows Windows NT

    Me complace haberme tomado el tiempo de leer este artículo específico porque tenía información útil. Saludos de nosotros en https://www.marketablegrowth.com/kamloops-website-design.

  31. abweb /
    Usando Google Chrome Google Chrome 105.0.0.0 en Windows Windows NT

    Very interesting blog. A lot of blogs I see these days don’t really provide anything that I’m interested in, but I’m most definitely interested in this one. Just thought that I would post and let you know
    Roof Replacement Rockhampton

  32. Anthony Scotte /
    Usando Google Chrome Google Chrome 105.0.0.0 en Windows Windows NT

    That is one of the great things! I am sure that you will also find many such useful things on this site. tree surgeon barnet

  33. Smokeless Powder /
    Usando Google Chrome Google Chrome 105.0.0.0 en Windows Windows NT

    It is a great post. We’re new to blogging as our primary source of income has always been freelance software engineering. I will be taking a look Smokeless Powder at some of these recommendations. Thanks for sharing!

  34. jordan laris /
    Usando Google Chrome Google Chrome 106.0.0.0 en Windows Windows NT

    Said control panel provides a simple way to manage domains, websites, and related services, such as mail, from its web interface. I really didn’t know this death run 3d

  35. jenny trippi /
    Usando Google Chrome Google Chrome 106.0.0.0 en Windows Windows NT

    Creating multiple email addresses from Plesk CLI is of great help to users. I will try it right away stickman boost

  36. Jim Brett /
    Usando Google Chrome Google Chrome 105.0.0.0 en Windows Windows NT

    I want to show you this klondike solitaire

  37. Dabwoods Shop /
    Usando Google Chrome Google Chrome 105.0.0.0 en Windows Windows NT

    Beneficial article for beginners. I am a beginner too, so these tips help me a lot thanks for sharing. It’s helpful for this blog. Dabwoods Shop Also, great with all of the valuable information you have. Keep up the excellent work you are doing well.

  38. Immanuel /
    Usando Google Chrome Google Chrome 106.0.0.0 en Windows Windows NT

    multiple directions can be quite confusing cleaning services orlando. i have a better map here.

  39. acoustical drywall /
    Usando Google Chrome Google Chrome 106.0.0.0 en Windows Windows NT

    In this way, we can configure a lot of email addresses with the same characteristics as acoustical drywall.

  40. Dabwoods GSC /
    Usando Google Chrome Google Chrome 105.0.0.0 en Windows Windows NT

    Thanks for sharing such a nice Blog Commenting Sites List. It is a very useful list of websites that help to rank our site and provide quality backlinks. Dabwoods GSC Backlinks play a pivotal role in SEO.

  41. mim /
    Usando Google Chrome Google Chrome 105.0.0.0 en Windows Windows NT

    Thanks, again for the tips, I always come to your website for updates and new posts. Since we work on search engine optimization, Buy fn 502 tactical fde it helps us a lot that it gives us so many opportunities in our line. And he gave us knowledge and points at the same time. I hope you’re on the right track.

  42. cannabis seed coupon codes /
    Usando Google Chrome Google Chrome 106.0.0.0 en Windows Windows NT

    Beneficial article for beginners. I am a beginner too, so these tips help me a lot thanks for sharing. It’s helpful for this blog. cannabis seed coupon codes Also, great with all of the valuable information you have. Keep up the excellent work you are doing well.

  43. Invisalign cost - Gellatly /
    Usando Google Chrome Google Chrome 106.0.0.0 en Windows Windows NT

    I wonder if this platform is free. It would be great to be able to create your own email address

  44. Kitchen remodel contractors San Bruno /
    Usando Google Chrome Google Chrome 106.0.0.0 en Windows Windows NT

    I am not expert to coding but thank you for this content. A huge help indeed!

  45. brittanyrlynn0516 /
    Usando Google Chrome Google Chrome 106.0.0.0 en Windows Windows NT

    Thanks a lot very much for the high quality and results-oriented help. I won’t think twice to endorse your blog post to anybody who wants and needs support about this area. Hope you can visit mine Drywall Finishing Vancouver

  46. oven cleaning cost /
    Usando Google Chrome Google Chrome 106.0.0.0 en Windows Windows NT

    Great blog !! You should start many more. I love all the info provided. I will stay tuned.
    oven cleaning cost

  47. dmt Shop /
    Usando Google Chrome Google Chrome 106.0.0.0 en Windows Windows NT

    Great Post !! very useful for me, is a great skill that depends on a couple of factors that are very well explained. dmt Shop Thanks for sharing! please keep it up Maintains!

  48. Berlyn eastonn /
    Usando Google Chrome Google Chrome 106.0.0.0 en Windows Windows NT

    Plumbing Abbotsford modifying is a hard thing to do. Among the versions I tried this one’s the most difficut.

  49. hornady superformance 30 06 sst 180 gr /
    Usando Google Chrome Google Chrome 106.0.0.0 en Windows Windows NT

    Great article. I want to say that I actually like browsing your website posts the most. The information you provide on this website is of great help to me. hornady superformance 30 06 sst 180 gr continue to share your new things. please keep it up Maintains!

  50. coffee cups /
    Usando Google Chrome Google Chrome 107.0.0.0 en Windows Windows NT

    This was very informative. Thanks for sharing. It worth the time reading this.

  51. Amarra /
    Usando Google Chrome Google Chrome 107.0.0.0 en Windows Windows NT

    This was an excellent post. Thank you for sharing it, view more

  52. Brielle Luna /
    Usando Google Chrome Google Chrome 107.0.0.0 en Windows Windows NT

    I remember how I felt sending letters before was like costing so much time but growing up, I realized I have been missing doing it so.
    best SEO services Tampa

  53. Lesly Jacks /
    Usando Google Chrome Google Chrome 107.0.0.0 en Windows Windows NT

    Thanks for taking this opportunity to discuss this, I feel fervent about this and I like learning about this subject. Sitio web

  54. Dilan /
    Usando Google Chrome Google Chrome 107.0.0.0 en Windows Windows NT

    Wow! Thank you for this information! Looking forward to more. basement remodeling Yonkers

  55. Andrea /
    Usando Google Chrome Google Chrome 107.0.0.0 en Windows Windows NT

    This is incredible! You just made my day and my workload much easier to handle. Thank you! basement renovation Brooklyn

  56. Keiren /
    Usando Google Chrome Google Chrome 107.0.0.0 en Windows Windows NT

    Could you really make these many in such a small amount of time? Woaahh thanks for this asbestos abatement Brooklyn

  57. Norie /
    Usando Google Chrome Google Chrome 107.0.0.0 en Windows Windows NT

    Thanks, You’ve got one of a kind creative ability and have come up with a few of the foremost inventive thoughts. http://www.contractorlethbridge.com

  58. Tamildhool /
    Usando Google Chrome Google Chrome 107.0.0.0 en Windows Windows NT

    Tamildhool is a video streaming website that offers more than 50 original shows and over 50,000 hours of Premium Content from leading Producers.

  59. mim /
    Usando Google Chrome Google Chrome 107.0.0.0 en Windows Windows NT

    Thanks, again for the tips, I always come to your website for updates and new posts. Since we work on search engine optimization, USA ID Cards it helps us a lot that it gives us so many opportunities in our line. And he gave us knowledge and points at the same time. I hope you’re on the right track.

  60. usps tracking number /
    Usando Google Chrome Google Chrome 107.0.0.0 en Windows Windows NT

    I really like the type of post that is simple so that everyone can understand and everyone can understand the message that the author wants to convey. Your style is unique but it is easy to understand what you want to say in this discussion.

  61. Harry /
    Usando Google Chrome Google Chrome 107.0.0.0 en Windows Windows NT

    This is my first visit to this website & I love to spend time in reading stuff here.
    Mister Saad

  62. Hailey /
    Usando Google Chrome Google Chrome 107.0.0.0 en Windows Windows NT

    Thank you. You have a unique capacity for creativity and have generated some of the most original ideas. exteriorpaintingmelbournefl.com

  63. tamildhoolserial /
    Usando Google Chrome Google Chrome 107.0.0.0 en Windows Windows NT

    very nice this site.

    tamildhoolserial

  64. custom packaging boxes /
    Usando Google Chrome Google Chrome 107.0.0.0 en Windows Windows NT

    creativity and have generated some of the most original https://custompackagingboxes.co.uk/

  65. Hannah Shyne /
    Usando Google Chrome Google Chrome 108.0.0.0 en Windows Windows NT

    Thank you for this! Siding Contractors Richmond, BC

  66. Yellowstone Jackets /
    Usando Google Chrome Google Chrome 107.0.0.0 en Windows Windows NT

    Yellowstone Jackets care for your fashion requirements. We uphold the premium quality John Dutton Jacket that bring you a new style.

Leave a Reply to Jim Brett Cancle Reply