{"id":22425188,"url":"https://github.com/2lenet/mailerbundle","last_synced_at":"2025-07-07T08:39:42.956Z","repository":{"id":56951964,"uuid":"135284251","full_name":"2lenet/MailerBundle","owner":"2lenet","description":null,"archived":false,"fork":false,"pushed_at":"2021-03-08T13:46:50.000Z","size":67,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-06T23:34:36.605Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/2lenet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-29T11:10:59.000Z","updated_at":"2019-06-24T07:32:31.000Z","dependencies_parsed_at":"2022-08-21T09:20:17.873Z","dependency_job_id":null,"html_url":"https://github.com/2lenet/MailerBundle","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2lenet%2FMailerBundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2lenet%2FMailerBundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2lenet%2FMailerBundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/2lenet%2FMailerBundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/2lenet","download_url":"https://codeload.github.com/2lenet/MailerBundle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245791967,"owners_count":20672671,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-05T19:13:27.137Z","updated_at":"2025-03-27T06:14:52.126Z","avatar_url":"https://github.com/2lenet.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MailerBundle\n\n### Requirements\n\n* PHP \u003e= 7.1\n* Symfony 4\n\n### Install\n\n```shell\n$ composer require 2lenet/mailer-bundle\n```\n\n\n### Usage\n\n```php\n    function index(MailerManager $mailerManager) {\n\n        $destinataires = [\n            '2le@2le.net' =\u003e [\"nom\" =\u003e\"Sébastien\"],\n            'jules@2le.net' =\u003e [\"nom\" =\u003e\"Jules\"]\n        ];\n        \n        $mail = $mailerManager-\u003ecreate('TEST', $destinataires); // create mail for all destinataires\n        $mailerManager-\u003esend($mail);  // send the mail\n    }    \n\n```\n\nIf you want to display the emails / display,edit and show the templates / display the receivers you need the bundle **esayadminplus** and the different configuration files : \nhttps://packagist.org/packages/2lenet/easyadmin-plus-bundle\n\n\nmenu.yaml\n```yaml\neasy_admin:\n    design:\n        menu:\n            -\n                label: menu.accueil\n                route: home\n                icon: home\n            -\n                label: menu.echeance\n                entity: Controle\n                icon: bell-o\n            -\n                label: menu.ressource\n                url: '/service.core/ressources?menuIndex=2\u0026submenuIndex=0'\n                icon: clone\n            -\n                label: menu.obligation\n                entity: Obligation\n                icon: bell\n            -\n                label: menu.suivi\n                icon: wrench\n                children:\n                    - { entity: Rapport, label: menu.rapport, icon: file-text }\n                    - { entity: Ticket, label: ticket.liste.nom, icon: ticket }\n                    - { label: menu.import_rapport, url: 'http://rapport.nathyslog.com', icon: sign-in }\n            -\n                label: menu.parametrage\n                icon: gear\n                children:\n                    - { entity: Service, label: menu.service, icon: sitemap }\n                    - { entity: Gabarit, label: menu.categorie_ressource }\n                    - { entity: Responsableobligation, label: menu.responsableobligation, icon: users }\n                    - { entity: Rubrique, label: menu.rubrique, icon: cubes }\n                    - { entity: Attributserviceclient, label: menu.attribut_service, icon: crosshairs }\n                    - { entity: TypeTicket, label: typeTicket.liste.nom, icon: list }\n                    - { entity: Priorite, label: priorite.liste.nom, icon: sort }\n            -\n                label: menu.admin_generale\n                icon: cogs\n                children:\n                    - { entity: Client, label: menu.client, default: true }\n                    - { entity: Categorie, label: menu.categorie }\n                    - { entity: Typegabarit, label: menu.type_categorie_ressource }\n                    - { entity: Typerapport, label: menu.type_rapport }\n                    - { entity: Typeresponsabilite, label: menu.typeresponsabilite }\n                    - { entity: Theme, label: menu.theme }\n                    - { entity: Typecontrole, label: menu.typecontrole }\n                    - { entity: Template, label: menu.template }\n                    - { entity: Mail, label: menu.mail }\n```\n\n\nMail.yaml\n``` yaml\n    easy_admin:\n    entities:\n        Mail:\n            class: Lle\\MailerBundle\\Entity\\Mail\n            disabled_actions: [delete, new, edit]\n            list:\n                title: title.mail.list\n                actions:\n                    - { name: new, icon: add }\n                    - { name: show, icon: search }\n                    - { name: edit, icon: edit }\n                    - { name: delete, icon: trash }\n                fields:\n                    #- { property: id, label: field.id }\n                    - { property: sujet, label: field.sujet }\n                    - { property: expediteur, label: field.expediteur, type: email }\n                    - { property: template, label: field.template }\n                    - { property: dateEnvoi, label: field.dateEnvoi }\n                    - { property: dateEnvoiFini, label: field.dateEnvoiFini }\n                    - { property: datePrevu, label: field.datePrevu }\n                    - { property: envoye, label: field.envoye, type: boolean }\n                sort:\n                    - dateEnvoi\n                    - DESC\n            show:\n                title: title.mail.show\n                actions:\n                    - { name: edit, icon: edit }\n                    - { name: delete, icon: trash }\n                fields:\n                    #- { property: id, label: field.id }\n                    - { property: sujet, label: field.sujet }\n                    - { property: data, label: field.data }\n                    - { property: template, label: field.template }\n                    - { property: dateEnvoi, label: field.dateEnvoi }\n                    - { property: dateEnvoiFini, label: field.dateEnvoiFini }\n                    - { property: datePrevu, label: field.datePrevu }\n                    - { property: envoye, label: field.envoye, type: boolean }\n                    - { property: expediteur, label: field.expediteur, type: email }\n                    - { property: replyTo, label: field.replyTo, type: email }\n                    - { property: returnPath, label: field.returnPath, type: email }\n                    - { property: alias, label: field.alias }\n                    - { property: sender, label: field.sender }\n                    - { property: infoSender, label: field.infoSender }\n                    - { type: 'sublist', id: 'destinataires', label: 'tab.destinataires', entity: 'Destinataire', property: 'Destinataires'}                    \n```\n\nTemplate.yaml\n``` yaml\neasy_admin:\n    entities:\n        Template:\n            class: Lle\\MailerBundle\\Entity\\Template\n            disabled_actions: []\n            list:\n                title: title.template.list\n                actions:\n                    - { name: new, icon: add }\n                    - { name: show, icon: search }\n                    - { name: edit, icon: edit }\n                    - { name: delete, icon: trash }\n                fields:\n                    #- { property: id, label: field.id }\n                    - { property: sujet, label: field.sujet }\n                    - { property: code, label: field.code }\n                    - { property: expediteurMail, label: field.expediteurMail, type: email }\n                    - { property: expediteurName, label: field.expediteurName }\n                sort:\n                    - id\n                    - DESC\n            show:\n                title: title.template.show\n                actions:\n                    - { name: edit, icon: edit }\n                    - { name: delete, icon: trash }\n                fields:\n                    #- { property: id, label: field.id }\n                    - { property: html, label: field.html, type: raw }\n                    - { property: text, label: field.text, type: raw }\n                    - { property: sujet, label: field.sujet }\n                    - { property: code, label: field.code }\n                    - { property: expediteurMail, label: field.expediteurMail, type: email }\n                    - { property: expediteurName, label: field.expediteurName }\n            edit:\n                title: title.template.edit\n                actions: []\n                fields:\n                    - { property: sujet, label: field.sujet }\n                    - { property: expediteurMail, label: field.expediteurMail, help: 'The e-mail address must include an @ followed by a domain name (ex: john@free.fr).' }\n                    - { property: expediteurName, label: field.expediteurName }\n                    - { property: code, label: field.code }\n                    - { property: text, label: field.text }                    \n                    - { property: html, label: field.html }     \n            new:\n                title: title.template.new\n                actions: []\n                fields:\n                    - { property: sujet, label: field.sujet }\n                    - { property: expediteurMail, label: field.expediteurMail, help: 'The e-mail address must include an @ followed by a domain name (ex: john@free.fr).' }\n                    - { property: expediteurName, label: field.expediteurName }\n                    - { property: code, label: field.code }\n                    - { property: text, label: field.text }                    \n                    - { property: html, label: field.html }                                        \n```\n\nDestinataire.yaml\n```yaml \neasy_admin:\n    entities:\n        Destinataire:\n            class: Lle\\MailerBundle\\Entity\\Destinataire\n            disabled_actions: []\n            list:\n                title: title.destinataire.list\n                actions:\n                    - { name: new, icon: add }\n                    - { name: show, icon: search }\n                    - { name: edit, icon: edit }\n                    - { name: delete, icon: trash }\n                fields:\n                    - { property: email, label: field.email }\n                    - { property: data, label: field.data, type: json }\n                    - { property: dateEnvoi, label: field.dateEnvoi }\n                    - { property: dateOuvert, label: field.dateOuvert }\n                sort:\n                    - id\n                    - DESC\n            show:\n                title: title.destinataire.show\n                actions:\n                    - { name: edit, icon: edit }\n                    - { name: delete, icon: trash }\n                fields:\n                    - { property: id, label: field.id }\n                    - { property: email, label: field.email }\n                    - { property: data, label: field.data, type: collection }\n                    - { property: dateEnvoi, label: field.dateEnvoi }\n                    - { property: dateOuvert, label: field.dateOuvert }\n                    - { property: url, label: field.url, type: raw }\n                    - { property: mail, label: field.mail }\n```\n                   \n### Entity\n\nYou can use your entity:\n\n```yaml\nlle_mailer:\n  template_class: \"App\\\\Entity\\\\MailTemplate\"\n  mail_class: \"App\\\\Entity\\\\Mail\"\n  destinataire_class: \"App\\\\Entity\\\\MailDestinataire\"\n```\n\nWarning: Use 3 entities or 0.\n\n```php\n\u003c?php\nclass MailTemplate implements TemplateInterface\n{\n    use TemplateEntityTrait;\n    \n}\n\nclass Mail implements MailInterface\n{\n    use MailEntityTrait;\n\n    /**\n     * @ORM\\ManyToOne(targetEntity=\"MailTemplate\", cascade={\"persist\"})\n     * @ORM\\JoinColumn(name=\"template_id\", referencedColumnName=\"id\", onDelete=\"CASCADE\", nullable=true)\n     */\n    protected $template;\n\n    /**\n     * @ORM\\OneToMany(targetEntity=\"MailDestinataire\",mappedBy=\"mail\", cascade={\"persist\"})\n     */\n    protected $destinataires;\n}\n\nclass MailDestinataire implements DestinataireInterface\n{\n    use DestinataireEntityTrait;\n\n    /**\n     *\n     * @ORM\\ManyToOne(targetEntity=\"Mail\",cascade={\"persist\"},inversedBy=\"destinataires\")\n     * @ORM\\JoinColumn(name=\"mail_id\", referencedColumnName=\"id\", onDelete=\"CASCADE\")\n     */\n    protected $mail;\n\n}\n```\n\n## Attachment\n\nIn order to send attachments with your email, you can use streamAttachment or attach a stored file. \n\n### Stored file\n\n```php\n $mail-\u003eaddAttachment(path/to/your/file);\n``` \n\nFor example, you can use it like that: \n\n```php\n$mail-\u003eaddAttachment($this-\u003ekernel-\u003egetProjectDir() . '/' . $pdf-\u003egetPath());\n``` \n\n### Dynamically created file\n\nAnother way, to send a file with an email, is to use \"streamAttachment\".\n\n```php\n $mail-\u003eaddStreamAttachments(String $data, String $filename, String $contentType);\n``` \n\n$data is the content of the file that you want to send.     \n$filename is the name of the file you want to send.     \n$contentType is type of the file you want to send. \n\n#### Remove all streamAttachment\n\nIn order to remove all attached dynamically created file you can use this method:\n\n```php\n $mail-\u003eremoveAllAttachments();\n``` \n\n#### Get all streamAttachment\n\nTo get all file (not stored, created dynamically) you can use this method:\n\n```php\n $mail-\u003egetStreamAttachments();\n``` ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F2lenet%2Fmailerbundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F2lenet%2Fmailerbundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F2lenet%2Fmailerbundle/lists"}