MailGun Laravel - Cant send to gmail - laravel-5

I have mailgun setup and working with my custom domain name, as in, I can send test emails to me#mydomain.com but when I try to send to gmail I get the following error.
ClientException in RequestException.php line 107:
Client error: `POST https://api.mailgun.net/v3/mydomain.com/messages.mime` resulted in a `400 BAD REQUEST` response:
{
"message": "Please activate your Mailgun account. Check your inbox or log in to your control panel to resend the act (truncated...)
My mailgun account is setup to work with my domain name correctly and my custom email address doesn't match my site domain name and mail gets delivered to it from mailgun no problems...
MAIL_DRIVER=mailgun
MAILGUN_DOMAIN=mydomain.com
MAIL_HOST=smtp.mailgun.org
MAIL_PORT=587
MAIL_USERNAME=postmaster#mydomain.com
MAIL_PASSWORD=ljhasdlkfhklahsdfklhklasdhflkhasdlkfhkhasdkflh
MAILGUN_SECRET=key-asdflkhjaklsdfkljaslkdfjlkjasdfkj
MAIL_FROM=postmaster#mydomain.com
MAIL_ENCRYPTION=tls
Its weird that when trying to send to a gmail address it gives tells me I need to activate my mailgun account but when sending to a custom domain name address its works perfectly, anyone have any ideas.. Here is the function I am using to send the emails
Mail::send('emails.recontact', ['title' => $title, 'content' => $content], function ($message) use ($request){
$message->from( 'me#mysite.ie', $request->input('name') );
$message->to('myname#gmail.com');
$message->subject("Website Enquiry");
});

You may need to activate you account.
Please login to your mailgun account and make sure there is no a yellow message on the top of the screen that said:
"Please activate your account to start sending emails. We sent an activation email to {your_email}. Resend activation. Update email address."
This solved my problem :)

I am working on mailgun but i faced different problem when recipient reply mail stores instead of delivered

Related

I got this error when i shoot the mail through mailgun.org in laravel8

Expected response code 354 but got code "421", with message "421 Domain sandbox4412497ba418406ba96c4a5332029424.mailgun.org is not allowed to send: Sandbox subdomains are for test purposes only. Please add your own domain or add the address to authorized recipients in Account Settings.
Like the message says you are using the test domain in mailgun.com. When using test domains you must add email addresses that are allowed to receive emails.
You can go to domain settings in mailgun add add recipient address to "Authorized Recipients".

Error sending email using Gmail SMTP with Laravel

I'm trying to send mails from my webserver using Laravel 6 like this:
Mail::send('feedback', ['email' => $email, 'text' => $text], function($message) use ($receiver)
{
$message->to($receiver, 'The receiver')->subject('New Feedback');
});
I added my login information into my .env file according to this page from google:
https://support.google.com/mail/answer/7126229?hl=de
my .env file:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=xxxx#gmail.com
MAIL_PASSWORD=my_gmail_login_password
MAIL_ENCRYPTION=tls
but I keep getting this error message:
Expected response code 250 but got code "530", with message "530-5.7.0 Authentication Required. Learn more at
530 5.7.0 https://support.google.com/mail/?p=WantAuthError
It looks like I would have used wrong credentials but I'm able to login with these credentials in gmail.
I also enabled insecure apps in my gmail settings.
I also tried to solve it by creating an app password and using it instead of my gmail password.
Nothing worked.
Does someone have an idea what I'm doing wrong?
when you want to send email from gmail you have to change some settings in gmail account.
Step 1: Configure your Google Account
Login to your Google Email Account and click on Google Account Button. This button is display when you click on the profile picture in your Gmail Dashboard as shown
Once you are on My Account Page then click on Security and scroll down to the bottom and you will find ‘Less secure app access’ settings. Click on the radio button to set it ON.
I think this link is helpful to you
https://medium.com/#agavitalis/how-to-send-an-email-in-laravel-using-gmail-smtp-server-53d962f01a0c
I could solve it by changing
MAIL_DRIVER=smtp
to
MAIL_DRIVER=sendmail
now I don't get any errors logged and everything seems to be working fine, but the mails don't get delivered to the mail address where they should be.

Why I When I using mailgun for sending from yahoo mail or sending to yahoo mail it not works?

when i using gmail email it can be reset and set the from recipents
but when using yahoo mail the set from doent send and reset to yahoo address was error with
Expected response code 250 but got code "554", with message "554 Sandbox subdomains are for test purposes only. Please add your own domain or add the address to authorized recipients in Account Settings. "
Did you check out this page?
If this is the cause you could try sending an text-only e-mail for testing purposes, see if that does works.

Laravel: All RCPT commands were rejected with this error: 503-relay not permitted, authentication required

I've made a website with Laravel which uses email to notify users of certain things. For testing on my personal computer, I used my gmail account for sending email from te website, which worked perfectly fine. Now I want to launch the website for the public and for the final version I want it to use noreply#mydomain to send email instead of my gmail adress.
Therefore I've set set the environment variables in the .env file like so:
MAIL_DRIVER=smtp
MAIL_HOST=mail1.webyte.eu
MAIL_PORT=587
MAIL_USERNAME=noreply#mydomain
MAIL_PASSWORD=mypassword
MAIL_ENCRYPTION=tls
The guy from my hosting service told me that this should be correct, however, when I try this, I get the following error:
Swift_TransportException (503) Expected response code 354 but got code
"503", with message "503-All RCPT commands were rejected with this
error: 503-relay not permitted, authentication required 503 Valid RCPT
command must precede DATA"
I've been searching the internet for a few days now and couldn't find anything that works for me...
Does anyone know what I should do here? Thanks!
I figured it out by changing :
MAIL_DRIVER=sendmail
Some servers have particulars settings. For instance, for my server on namecheap I had need to add these vars in .env file
MAIL_FROM_ADDRESS=noreply#mydomain
MAIL_FROM_NAME=NoReply
I also fix this error by including the following on my .env file:
MAIL_DRIVER=sendmail
This error is raise from your SMTP email service provider. Laravel uses SwiftMailer to send email. So you can catch the error by using this below method
try {
Mail::send('emails.contact-message', [
'msg' => $request->body,
'name' => $request->name,
'email' => $request->email,
],
function ($mail) use($request) {
$mail->from($request->email, $request->name);
$mail->to('support#domain.com')->subject('Contact Message');
}
);
// Catch the error
} catch(\Swift_TransportException $e){
if($e->getMessage()) {
dd($e->getMessage());
}
}
This question is a bit dated, but I think my answer may be useful to someone else.
I was getting OP's error message with my organization's Microsoft Exchange server using Laravel & SwiftMailer.
It turned out that I could send email to internal emails (the same domain name), but not external ones. The error message provided by SwiftMailer was misleading and sent me looking in the wrong direction for a while.
I would recommend testing your SMTP server with internal (same domain name) and external emails using telnet as another debugging step, which will provide accurate error messages:
https://www.jasonsamuel.com/2009/12/17/send-email-via-telnet-to-test-an-exchange-server/
To resolve this issue, I had to get my organization's IT team involved. More info:
https://github.com/swiftmailer/swiftmailer/issues/1181#issuecomment-490920874

Namecheap\Mailgun - receiving email

I am wondering how to setup namcheap and maligun to receive emails. Currently I am able to send emails with my laravel application through maligun, but I am not sure how to setup maligun to receives replies?
I have seen the options of setting up routes to receive emails to some wanted enpoint, but currently I am not receiving anything on maligun, so I have nothing to forward. I am getting the message:
This is the mail system at host eforward3e.registrar-servers.com.
I'm sorry to have to inform you that your message could not be
delivered to one or more recipients. It's attached below.
For further assistance, please send mail to postmaster.
If you do so, please include this problem report. You can delete your
own text from the attached returned message.
The mail system
: unknown user:
"support#my-domain.com"
Final-Recipient: rfc822; support#my-domain.com
Original-Recipient: rfc822;support#my-domain.com Action: failed
Status: 5.1.1 Diagnostic-Code: X-Postfix; unknown user:
"support#my-domain.com"
How should I set this up?
Hope you register your domain at mailgun, if not then do it here. Once your domain register follow below steps:
1) Get domain and API Key from Mailgun > Doamins > Domain Information page
2) Setup config/services.php:
'mailgun' => array(
'domain' => 'YOURDOMAINNAME',//Place your register domain name here...
'secret' => 'API Key',//Place your API Key here...
),
3) Setup .env:
MAIL_DRIVER=mailgun
MAIL_HOST=smtp.mailgun.org
MAIL_PORT=587
MAIL_USERNAME=USERNAME
MAIL_PASSWORD=YOURPASSWORD
MAIL_ENCRYPTION=tls
4) Check with sending mail from laravel application.
That's it...

Resources