Laravel mail doesn't send when embedding link - php

I am developing password reset api on backend using Laravel 4.2. It is quite obvious that emails are not sending out if I embed http url . Normal email are sending out properly. Here is how I send email
Laravel Function
Mail::queue('emails.auth.confirm_password',$detail,function($message) use ($email)
{
$message->from('abc#gmail.com', 'Test');
$message->to($email)
->subject('Verification');
});
emails.auth.confirm_password.php
<p>We got a request to reset your Gurilla password. </p>
Reset Password
<p>If you ignore this message, your password won't be changed</p>
I tried many alternatives with no luck. I believe sth weird going on. Might some expert help :-). thanks

Related

Laravel Mailgun tracking emails

I'm trying to track emails sent via laravel mailgun driver. I want to be able to view the emails in the 'analytics' page of app.mailgun.com.
I am able to send emails using Postman with the following headers: o:tag o:tracking o:tracking-clicks o:tracking-opens and these seem to work fine. I can see these in the 'analytics' page. I have also successfully set up web hooks so I can track individual events for each email.
According to the documentation if I am sending via SMTP I need to send these tags: X-Mailgun-Track: yes, X-Mailgun-Track-Opens = yes. I have set these using the following code in the build method of my mailable class:
$this->withSwiftMessage(function ($message) {
$message->getHeaders()->addTextHeader(
'X-Mailgun-Track', 'yes'
);
$message->getHeaders()->addTextHeader(
'X-Mailgun-Track-Opens', 'yes'
);
});
I can see these headers are added when I open the email in a text editor. The email does not show up in the mailgun 'analytics' page.
Any help on this would be appreciated. Thanks!

CakePHP and masking email sender

I am currently using a function called send:
public function send(){
if ( !empty($this->request->data) ) {
$email = new CakeEmail('default');
$email->from(array($this->Auth->user('email') => $this->Auth->user('username')))
->to(array('helpdesk#example.com'))
->subject($this->request->data['Ticket']['subject'])
->send(array($this->request->data['Ticket']['issue']));
$this->Session->setFlash('Email Sent Successfully', 'default', array('class' => 'message update span9'));
$this->redirect(array('action' => 'index'));
}
to Send emails to our helpdesk and deposit them into their database. All is working EXCEPT the FROM always shows the username/email address from the configuration options. It is not masking the email with the users email.. I need this to happen so that we know who is having the support issue.
Does anyone have a suggestion here on what to do?
*Addition
This is an intranet application and thus we have an authenticated GENERIC USER using smtp settings. This is not spamming, we just want to know which user the Help Desk ticket came from when inserting to the DB.
Why are you using the Config default anyway?
If you use $email = new CakeEmail();, does the email sent references the Authenticated User email info.
Also, you should always use $email->sender('support#yourcompany.com', 'Your Company Support');. This ensures that if there is an issue the problem get redirected to you and not the user, your app is sending an email on his/her behalf.
I have that setup in my account and it works just fine. To Mark's point, it may not be legal (although, that does not seem to be your issue), but I know it is possible as I have currently a system setup that works with whatever email I want. I do not use any Config and also I do not use any SMTP

Multi functional email set up with Code igniter

I have an application built in CodeIgniter. I needed some help with the following email related tasks. Please note all emails will require SSL.
1) Send email to congratulate and welcome the user to the site
2) Send an email to confirm a user account has been deleted should they choose to leave.
3) Send an email to alert the user for a request sent to them from another user.
4) Set up and send an email for "forgot username" and last but not not least
5) Send an email to reset password in case the user can't remember how to login.
Thanks for your help, appreciate it.
function signup(){
$data = array(
'sign_up_mail'=>'Welcome and thanks for joining...'
);
$htmlMessage = $this->parser->parse('user/email/signup_html', $data, true);
$txtMessage = $this->parser->parse('user/email/signup_txt', $data, true);
#send the message
$this->email->from('test#gmail.com', 'test app');
$this->email->to($this->input->post('email_address'));
$this->email->subject('Account Registration');
$this->email->message($htmlMessage);
$this->email->alt_message($txtMessage);
$this->email->send();
}
Would you use this listed below as the method for changing the message within the various emails?
data['message'] = "Hey there, you've got a follower request!";
$email = $this->load->view('email/template', $data, TRUE);
I presume this method works for simple things like user welcome and alerts etc. How would I go about connecting a process to resetting a username/password or confirming a deletion? How do you connect the email process with manipulating data in the db?
From your question, I think you are looking for some kind of authentication related tasks. If so, there is an authentication, library in codeigniter, that provides complete authentication system. Have a look, it it is useful to you. http://konyukhov.com/soft/tank_auth/

Google App-Gmail Unable to set from. Gmail replacing from address when sending via swiftmailer SMTP transport (PHP)

Hello and thank you for any help in advance.
I'm using swiftmailer, SMTP transport method to send email from my PHP script.
Sending the message is fine. It works.
The problem is, no matter what I set the FROM,REPLYTO,SENDER settings to, The email comes through as the GMAIL mailbox (ME - me#mydomain.com) instead.
$transport = Swift_SmtpTransport::newInstance('imap.gmail.com', 465,'ssl')
->setUsername($login)
->setPassword($password)
;
$message = Swift_Message::newInstance($subject)
->setFrom(array('test#testdomain.com' => 'test mcttest'))
->setReplyTo(array('test#testdomain.com' => 'test mcttest'))
->setSender('test#testdomain.com')
->setTo(array($to))
->setBody(wordwrap($body, 70))
->setContentType('text/plain')
;
So the email goes through fine, but instead of being from TEST-test#testdomain.com as the sender... it's ME-me#mydomain.com
I switch to a separate (non-gmail) SMTP server to test and the email went through fine, without any problems... definitely think it's a GMAIL thing.
Anyone know how to get around this?
Yes, it is Gmail that changes the sender e-mail address to be the same of the account you are authenticating. There is no workaround for that, except maybe becoming a paid customer of Google Apps.
Funnily enough I've come across the same issue. But as a bit of an insight, I think this is actually a Swiftmailer issue.
There are other libraries and frameworks (Codeignitor pops in my head) that will let you use Googlemails SMTP servers while masking the from address as an email address of your choosing.

Processing an Email Bounce back in CakePHP and Postfix

I'm trying to handle bounced message and send to a responsible System Administrator.
I use CakePHP Email Component to send the message. On server side, I use postfix to transport the message.
function sendAsEmail($data) {
$Email->sendAs = 'html';
$Email->from = $user['Sender']['username'] . '#example.com';
$Email->return = Configure::read('App.systemAdminEmail');
$Email->bcc = array($data['Message']['recipient_text']);
$content = 'Some content';
$Email->send($content);
}
As you can see above, I set the $Email->return to sysadmin's email which it will send all the bounced message.
On postfix configuration, I tried creating a bounce.cf template and set bounce_template_file. http://www.howtoforge.com/configure-custom-postfix-bounce-messages
How do I get the bounced message and send it to System Administrator?
I think what you'll need to do is to use an SMTP (or I suppose POP3) connector for PHP. Then you'll basically have to create your own PHP email client that will login to the server, ask for the messages that have been bounced, and parse them appropriately.
I would think there would be a CakePHP component for this, but I can't find one.
I would recommend that you use an Envelope Header in your email. Otherwise you'll be stuck trying to parse the recipient server bounce, and those are very very inconsistent. If you use the VERP (variable envelope return protocol?) header, you can encode a unique hash into the email address which should be really easy to parse out in your PHPEmailClient.
More info on VERP: http://en.wikipedia.org/wiki/Variable_envelope_return_path
Cake-specific VERP stuff: http://www.mainelydesign.com/blog/view/setting-envelope-from-header-cakephp-email-component
I also highly recommend that you look into using SwiftMailer. It has a lot of plugins; you might find a base PHP SMTP client that you can easily modify to do what you need. http://swiftmailer.org/

Categories