question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Describe the bug I am not sure if this is a bug or it’s just me having issue, but I am not able to make it work, following is the detailed code that I am using.

UserRegistration Mailable

from masonite.environment import env
from masonite.mail import Mailable


class UserRegistration(Mailable):
    def build(self):
        return (
            self.subject("ACCOUNT REGISTRATION")
                .from_(env('MAIL_FROM_ADDRESS'))
        )

Inside controller

        try:
            mailable = UserRegistration().set_application(application).to("test@example.com").text("Hello World")
            mail.send(mailable)
        except Exception as e:
            print("ERROR")
            print(str(e))

Note: I am using mailtrap.

Exception is thrown

ERROR
<app.mailables.UserRegistration.UserRegistration object at 0x104e65b50>

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
yubarajshresthacommented, Jan 4, 2022
FROM_EMAIL = env("MAIL_FROM", "no-reply@masonite.com")

DRIVERS = {
    "default": env("MAIL_DRIVER", "terminal"),
    "smtp": {
        "host": env("MAIL_HOST"),
        "port": env("MAIL_PORT"),
        "username": env("MAIL_USERNAME"),
        "password": env("MAIL_PASSWORD"),
        "from": FROM_EMAIL,
    },
    "mailgun": {
        "domain": env("MAILGUN_DOMAIN"),
        "secret": env("MAILGUN_SECRET"),
        "from": FROM_EMAIL,
    },
    "terminal": {
        "from": FROM_EMAIL,
    },
}

I do have the same configuration.

0reactions
yubarajshresthacommented, Jan 4, 2022

Following solution fixed the issue:

 try:
            mailable = UserRegistration().set_application(application).to("test@example.com").text("Hello World")
            mail.mailable(mailable).send()
        except Exception as e:
            print("ERROR")
            print(str(e))
Read more comments on GitHub >

github_iconTop Results From Across the Web

MailBug™ | Email Simplified
MailBug is email simplified. It's designed for those who'd like to use email, but lack the technical skills and experience typically required. It's...
Read more >
Mailable bug · Issue #20059 · laravel/framework - GitHub
even though I'm entering an email string It is conflicting with the system email address that I have setup in mail.php.
Read more >
So, You Want To Mail A Bug? | Kentucky Pest News
Placing the insect into a paper envelope with no protection usually leads to them being crushed by mail sorting machines.
Read more >
Email Bug in the mail app on iPhone | Apple Developer Forums
in the mail app on the iphone on the mail box page it is showing a draft email at the bottom and if...
Read more >
Edison Mail bug exposed users' email accounts to complete ...
Edison Mail bug exposed users' email accounts to complete strangers. The makers of a popular iOS email app have warned their users that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found