Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

Correct way to use multiple outgoing mailservers for multiple users?

Subscriure's

Get notified when there's activity on this post

This question has been flagged
mailmailserverodoo8.0
1 Respondre
12996 Vistes
Avatar
Yenthe Van Ginneken (Mainframe Monkey)

Hi guys,

Every now and then I play around with the mail module and the features but I seem to run stuck on one point, everytime.
Imagine that you have three users: UserA, UserB and UserC.
Its perfectly possible to configure an incoming mail server for every user (so three incoming mail servers) however when you want to create three outgoing mail servers the problems start.
You can create three different outgoing mailservers but the one with the highest priority will always be used, no matter what.

My question is, what is the correct way to create multiple outgoing mail servers and use all of them depending on the user that is sending an email? An example:

UserA wants to send a message to a customer which he has just created under 'Sales' > 'Contacts'. He types a messages and submits this. It will now be e-mailed with the outgoing mailserver with the lowest priority, lets assume this is OutgoingmailserverUserA.
When UserB now wants to send an email out to the same customer but from another e-mail (OutgoingmailserverUserB) it will be sent with the mailserver from OutgoingmailserverUserA, since this has the lowest priority.

How can I create multiple outgoing mailservers and send an e-mail out depending on the user? This feature does not seem to exist out of the box and the only option seems to be to have one outgoing mailserver for all users?..

Thanks,
Yenthe

2
Avatar
Descartar
Futurelens

Use multiple outgoing mail servers for multiple users you can use this module: https://apps.odoo.com/apps/modules/14.0/fl_outgoing_mail_server_user/

Avatar
Emipro Technologies Pvt. Ltd.
Best Answer

Yenthe,

I have asked same question before few days :

https://www.odoo.com/forum/help-1/question/how-to-send-email-by-userwise-modelwise-using-differnent-outgoing-servers-87768

I made a module for this and added a many2one field in outgoing server ( ir.mail_server model ) At the time of send mail, i checked if there is no default mail_server_id available then system will get the related mail server from "uid".

For example, see following method. ( Please give attention to bold lines )

class ir_mail_server(osv.osv):
    _inherit = "ir.mail_server"
    _columns = {
                'user_id_ept':fields.many2one('res.users','User',help='When user is assigned then \
                                    at the time of email sending from Odoo if no outgoing server found then \
                                    system will take the server which is assigned to this user.') 
                }
    
    def send_email(self, cr, uid, message, mail_server_id=None, smtp_server=None, smtp_port=None,
                   smtp_user=None, smtp_password=None, smtp_encryption=None, smtp_debug=False,
                   context=None):
        mail_server = mail_server_id
        if not mail_server :
            user_obj = self.pool.get('res.users').browse(cr,uid,uid)
            email = user_obj.partner_id and user_obj.partner_id.email or False
            if email :
                mail_server_ids = self.search(cr, SUPERUSER_ID, [('user_id_ept','=',uid)], order='sequence', limit=1)
                if mail_server_ids :
                    mail_server = mail_server_ids[0]
        return super(ir_mail_server,self).send_email(cr, uid, message,
                                                    mail_server_id=mail_server,
                                                    context=context)  


In a nutshell, before Odoo checks low priority outgoing server in case of if there is no mail server specified, I added condition to check outgoing server related to user configured on it with "uid". ( this sentence may be hard to understand ;) )

From my thinking this is the only way. However in my question i raised another interesting point. If you have a time please read it as well.

Latest Update : This module is out to Odoo store now. It is a Free App. You can download from this link. 

3
Avatar
Descartar
Yenthe Van Ginneken (Mainframe Monkey)
Autor

Hi Emipro, thanks a lot for your reply! I was thinking about doing exactly the same and I see that as the only option too. Is your module available anywhere on Github or something? It would be a waste if I would have to program the entire thing again while you've made this. Perhaps this is something you could put online on apps? I honestly think this would be great. I'll upvote this for now but I'll leave the accepting open for other responses too. :)

Emipro Technologies Pvt. Ltd.

Yenthe, that module is already available at myside but with more specific features. Tonight I will make it separate and post in Odoo Apps for free to download. Also I will inform you to your email so you can download it. Give me your email. (y)

Yenthe Van Ginneken (Mainframe Monkey)
Autor

Great Emipro! You can always drop me an e-mail at yenthe.vanginneken@vanroey.be , also to talk about other things regarding Odoo. Looking forward to your module, thanks!

Emipro Technologies Pvt. Ltd.

Yenthe, I sent you module on your specified email address. Enjoy !

Ricardo Gross

Could you please update the app link?

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registrar-se
Related Posts Respostes Vistes Activitat
Hostinger Mail - Odoo
mail mailserver
Avatar
0
de maig 24
2991
Critical Problem: Odoo 14 auto responder loop to mails from unknown sender
mail mailserver
Avatar
0
de març 21
3633
Odoo 8 mail problems: Admin receives all messages / notification of new mails not working
mail odoo8.0
Avatar
0
de jul. 16
4034
Automatic record creation fails on incoming mails
mail mailserver
Avatar
0
de març 16
4220
where can I find openerp_mailgate.py on v8? Solved
mail mailserver
Avatar
Avatar
Avatar
2
d’ag. 15
6444
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now