Link to home
Create AccountLog in
Avatar of Devario Johnson
Devario JohnsonFlag for United States of America

asked on

cakephp email component to outlook

Hi, I have an interesting issue.

I have developed an application in cakePHP that takes advantage of the built in cakephp core email component.

When sending emails to regular clients like gmail, it is fine, but when you send that same email to addresses that utilize outlook all of the header information shows up in the email.  is there a way i can remove or hide the header information (display) for outlook? User generated image
Avatar of mattibutt
Flag of United States of America image

you should use phpmailer class and format your email in a proper way with phpmailer you can define your own email template which will create consistent look and feel
Avatar of Devario Johnson


is that built in?  Or are you referring the the 3rd party phpmailer?
@mattibut I tried the phpmailer and I got alot of errors and issues.

is there a way i can use the native php mail($to, $subject, $body, $headers) without having to use these vendor packages?

I really only need to send a very simple email
Yes, you can use the native PHP mail() function.  However you may be running on a server that inserts anti-spam headers into the outgoing automated mail.  Send the mail to yourself at a GMail account so you can look at the headers easily.  It will be easier to debug that way.

On  my Gmail account, you use the down-arrow and click "Show Original"
how do i use the native mail function?  i tried in the controller and in a component and it didnt work...unless i did it wrong...can you supply a snipplet?

(i didnt get an error)

@Ray, I looked at the gmail, and the same headers that are in the outlook are there when i do the downarrow > show original with a few others.  i didnt recognize any anti spam stuff unless taht is what you are referring to.
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
well, I already know how to use the mail function.  i need to know how to get it to work within the framework
i think a snipplet would be great highlighting where you did it and any other miscellaneous info... like if you made it a component and i had to add the name to the components array etc...

ok guys...i am so sorry for wasting your time on this one...i just tried it and it worked on the first try...

for anyone who completely overthought this like i did

just pop it in the controller   :S

it's crazy how the simplest stuff can't be achieved when you completely overthink something :(
Ha!  Thanks for the points -- glad you have it pointed in the right direction now. ~Ray
Yea, I dont know what i was thinking.  

I already knew how to do that, it is mere basic php, i mean, I even typed it in one of my responses...just for some reason, i was thinking that i needed to do something special to get it to work within the cake framework.

This just goes to show, you really shouldnt over think stuff

Oh and by the way, for anyone else who is reading this, to get rid of the header completely in outlook, make sure that your $header variable only has a 'From:'  if you put any thing else outlook will print the headers.

I havent tried with an html email as of yet using this method in cake, but for plain text this works.