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 43 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?

    1. Janet /
      Usando Google Chrome Google Chrome 116.0.0.0 en Windows Windows NT

      Same here! Really great! sandblasting

  2. 메이저사이트 /
    Usando Google Chrome Google Chrome 116.0.0.0 en Windows Windows NT

    An interesting article like yours. Its appearance is enough for me. In my opinion, if all website owners and bloggers can create exciting content like you, then the internet may be more helpful than ever before메이저사이트

  3. Dawn /
    Usando Google Chrome Google Chrome 116.0.0.0 en Windows Windows NT

    Really great blog! Keep it up! skip hire in wirral

  4. Jacky Smith /
    Usando Google Chrome Google Chrome 116.0.0.0 en Mac OS X Mac OS X 10.15.7

    Your article is truly captivating. Its mere presence is a delight. In my view, if website owners and bloggers across the internet could consistently produce engaging content like yours, the web would become an even more invaluable resource than ever before
    weight loss coach Brisbane

  5. invest2euro.com /
    Usando Google Chrome Google Chrome 116.0.0.0 en Windows Windows NT

    Provide unbiased reviews of online brokers, trading platforms, and financial tools. invest2euro.com

  6. 메이저놀이터 /
    Usando Google Chrome Google Chrome 116.0.0.0 en Windows Windows NT

    Your blog is refreshing after reading. I will be very happy to see your words, and I hope that more and more people can also feel this joy when they see them. Your writing style is great, I really like you.메이저놀이터

  7. spanish to english /
    Usando Google Chrome Google Chrome 116.0.0.0 en Windows Windows NT

    I can see that you are an expert in your field! I am about to launch a website and your information spanish dictionary will be very helpful to me.. Thank you for all your help and wish you success in your business.

  8. Mary /
    Usando Google Chrome Google Chrome 116.0.0.0 en Windows Windows NT

    Love this blog! Really great! liverpool marquee hire

  9. prds /
    Usando Google Chrome Google Chrome 116.0.0.0 en Windows Windows NT

    Pretty nice post. I just stumbled upon your weblog and wanted to say that I have really enjoyed browsing your blog posts. After all I’ll be subscribing to your feed and I hope you write again soon!

    My website: OKBet download

  10. drywall /
    Usando Google Chrome Google Chrome 116.0.0.0 en Windows Windows NT

    However, it also has a number of command line tools that can be used to automate tasks or perform more complex operations.

  11. labs itbacklabs /
    Usando Google Chrome Google Chrome 116.0.0.0 en Windows Windows NT

    architecte marrakech

  12. labs itbacklabs /
    Usando Google Chrome Google Chrome 116.0.0.0 en Windows Windows NT

    Située a Marrakech, cette Consulting industriel Maroc

  13. labs itbacklabs /
    Usando Google Chrome Google Chrome 116.0.0.0 en Windows Windows NT

    Provide public numbers Numeros virtuels

  14. labs itbacklabs /
    Usando Google Chrome Google Chrome 116.0.0.0 en Windows Windows NT

    Welcome to Marrakech Art Tours, Tours Marrakech

  15. labs itbacklabs /
    Usando Google Chrome Google Chrome 116.0.0.0 en Windows Windows NT

    ManagePro Application de gestion Maroc

  16. labs itbacklabs /
    Usando Google Chrome Google Chrome 116.0.0.0 en Windows Windows NT

    GymPro est une de Application de gestion de salle de sport

  17. 메이저사이트 /
    Usando Google Chrome Google Chrome 116.0.0.0 en Windows Windows NT

    I saw some great things here. Worth collecting for follow-up visits. I am surprised how much effort you have put into creating such a rich content website. Your work is truly appreciated 24/7 worldwide. 토토사이트

  18. Shweta Malik /
    Usando Google Chrome Google Chrome 116.0.0.0 en Windows Windows NT

    It’s very informative and you are obviously very knowledgeable in this area. Delhi Call Girl You have opened my eyes to varying views on this topic with interesting and solid content.

  19. 먹튀신고 /
    Usando Google Chrome Google Chrome 116.0.0.0 en Windows Windows NT

    Do you know your post is very good? Very distinctive. I really admire you. I really should study like you. Thank you. I’m glad to brush up on your post.먹튀신고

  20. UFABET1688X /
    Usando Google Chrome Google Chrome 116.0.0.0 en Windows Windows NT

    ยูฟ่าเบท168 แทงบอลได้ทุกที่ ทันทีที่ต้องการ สล็อตเว็บตรงอันดับ1 ที่ให้คุณสนุกได้ทุกรูปแบบ

  21. 먹튀검증 /
    Usando Google Chrome Google Chrome 116.0.0.0 en Windows Windows NT

    Excellent post! The description of cartoon characters and real writers is presented in surprising ways. Children can easily enjoy it.먹튀검증

  22. Delhi Escorts /
    Usando Google Chrome Google Chrome 116.0.0.0 en Windows Windows NT

    If you are in town and wish to go on an adventurous ride and get your fantasies to become reality, you have come to the right place, just look through our pictures of our Delhi Escort and give us a call. Our escort will be at your doorstep ready to make your dreams come true and will give you the time of your life.

  23. john dutton season 4 jacket /
    Usando Google Chrome Google Chrome 116.0.0.0 en Windows Windows NT

    There’s something timeless about John Dutton’s Season 4 jacket, and the quilted texture elevates its overall appeal. It’s the kind of piece that effortlessly combines style and substance, just like the character himself. A jacket that tells a story

  24. Riya Nayar /
    Usando Google Chrome Google Chrome 116.0.0.0 en Windows Windows NT

    These Delhi Escorts Agency are incredibly fiery and can perform with you for quite a while. The nearby fun-searchers used to recruit them consistently because of their astounding administrations.

  25. 토토사이트추천 /
    Usando Google Chrome Google Chrome 116.0.0.0 en Windows Windows NT

    Great website, I like it. Well done. Nice website. Love it. This is really good,This is exciting content! I was attracted by your speech and precise viewpoints.토토사이트추천

  26. John /
    Usando Google Chrome Google Chrome 116.0.0.0 en Windows Windows NT

    Thank you for this great read. Concrete Contractors Wagga really thankful to you for giving us blog commenting sites. It has been useful.

  27. Rohan Rajput /
    Usando Google Chrome Google Chrome 116.0.0.0 en Windows Windows NT

    Our Delhi Escorts Service have become an essential part of evening services in the resources city. Our qualified ladies are readily available for reserving 24/7 in the city. Whether you need a warm friend in lavish hotels or houses, our turned on women companions in Delhi will reach you within a short time. That is the commitment of our sensuous friends. Furthermore, you can expect unequaled romantic and also sensual solutions from our ladies.

  28. cookie clicker /
    Usando Google Chrome Google Chrome 116.0.0.0 en Windows Windows NT

    Simply outstanding work from you in this regard. I have never anticipated that you would provide anything less than this, and you have in no way let me down in this regard. I have no doubt that you will maintain the high standard of your work.

  29. L. Martin /
    Usando Google Chrome Google Chrome 116.0.0.0 en Windows Windows NT

    Reading by means of your enjoyable dispatch, desire further me to do so sometimes. pool installation sarasota

  30. Me /
    Usando Google Chrome Google Chrome 116.0.0.0 en Windows Windows NT

    Great article. Generator Residential Generator Residential

  31. Delhi Call Girls /
    Usando Google Chrome Google Chrome 116.0.0.0 en Windows Windows NT

    People who love luxuries are able to relish lovemaking with these exotic babes. Pleasure seekers who have played with these exotic love-makers before said, Russian escorts release a unique fragrance from their body which ignites their sparks. Russians hold the exceptional qualities and features which can’t be found in any other category of escorts in Delhi. If you need to play sensuously before intercourse to be seduced so appointing Russian escorts in Delhi would an ideal choice. These exotic beauties know to satisfy one’s hunger in more than twenty various styles.

  32. Digital Classic Gadget /
    Usando Google Chrome Google Chrome 116.0.0.0 en Windows Windows NT

    This article is great as well as inspiring. Keep sharing more related articles. Great work! Thank you.

  33. 토토사이트 /
    Usando Google Chrome Google Chrome 116.0.0.0 en Windows Windows NT

    You have written a very good viewpoint here Great thing I think you have put forward some truly interesting viewpoints. Keep working hard.토토사이트 Thank you very much for sharing with us and for discovering a new factor in your respective posts.

  34. Usando Google Chrome Google Chrome 117.0.0.0 en Windows Windows NT

    Excellent post. acer swift x sfx14-41g-r1s6 creator laptop review I really liked each part and also bookmarked you for new information on your site.

  35. SimonWhitehead /
    Usando Google Chrome Google Chrome 116.0.0.0 en Windows Windows NT

    Wow what a Great Information about World Day its exceptionally pleasant educational post. a debt of gratitude is in order for the post. Antigua

  36. Aquablast MN /
    Usando Google Chrome Google Chrome 116.0.0.0 en Windows Windows NT

    thanks for the information http://www.aquablastmn.com/soft-washing

  37. Escort in Goa /
    Usando Google Chrome Google Chrome 117.0.0.0 en Windows Windows NT

    You should also check on their websites for reviews and feedback given by their current or former clients. This helps to understand the quality of their service from a customer’s perspective. Ratings and reviews can shed light on any issues or complaints about an agency. But do keep in mind, that if an escort agency’s website doesn’t include a section for reviews, it might be a bit risky to fully trust them.

  38. Escorts Service in Goa /
    Usando Google Chrome Google Chrome 117.0.0.0 en Windows Windows NT

    There are many types of escorts, and they come from all walks of life. Some are students who need extra money for tuition, while others are single mothers who need to support their children. Foreigner escort girls support their families by coming to Goa due to a lack of employment in their country. There are also such types of women who do it because they enjoy it. Whatever their reason, one thing is for sure: they all want money.

  39. L. Martin /
    Usando Google Chrome Google Chrome 117.0.0.0 en Windows Windows NT

    It’s always a pleasure to come across an intriguing topic of yours like this. credit repair san antonio

  40. L. Martin /
    Usando Google Chrome Google Chrome 117.0.0.0 en Windows Windows NT

    It’s always a pleasure to come across an intriguing topic of yours like this. screen enclosures fort lauderdale

  41. glock 44 for sale /
    Usando Google Chrome Google Chrome 117.0.0.0 en Windows Windows NT

    Thank you for this great read. I am really thankful to you for giving me glock 44 for sale blog commenting sites. It has been useful.

  42. shanaya sharma /
    Usando Google Chrome Google Chrome 117.0.0.0 en Windows Windows NT

    We never concoct low class escort administrations as we put stock in offering premium administrations to our clients. Ghaziabad Call Girls We ensure that all our attractive hunks get to satisfy their dreams and wants with full energy and positive thinking. The most amazing aspect of having our escort administrations is their moderateness. We have the best and modest escort administrations in for our clients so they can include everything inside their spending plan. Thusly, reach out to us to enlist your escort friend now.

Leave a Reply