Jacek's send HTML mail issue

Ask about a PHP problem here.
Post Reply
Fidbeck
Posts: 147
Joined: Tue Sep 25, 2012 11:40 pm

Jacek's send HTML mail issue

Post by Fidbeck »

I wanted to send an email as HTML and I followed Jacek's video on how to send HTML mails but I'm getting a problem here...
[syntax=php]
$headers = array(
'From: plus1@something.net',
'Content-Type: text/html'
);

mail($for, $subject, $body, implode("\r\n", $headers));[/syntax]
is is giving me an error
Error: There is 1 array declaration that contain text character variables or values without quotations:
array( 'From: plus1@something.net', 'Content-Type: text/html' );


but if I put it like
[syntax=php]
$headers = array('From: plus1@something.net',
'Content-Type: text/html'
);
[/syntax]
it works fine.

So should I change the inplode into just $headers or what?
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Jacek's send HTML mail issue

Post by jacek »

Those two things should be the same :S That is not a standard PHP error, do you have some kind of debugging tool that is making stupid mistakes ?
Image
Fidbeck
Posts: 147
Joined: Tue Sep 25, 2012 11:40 pm

Re: Jacek's send HTML mail issue

Post by Fidbeck »

I checked for the code here phpcodechecker.com
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Jacek's send HTML mail issue

Post by jacek »

Fidbeck wrote:I checked for the code here phpcodechecker.com

Don't do that, it's apparently pretty bad :P Adding or removing a line break should not change the way anything functions.
Image
Fidbeck
Posts: 147
Joined: Tue Sep 25, 2012 11:40 pm

Re: Jacek's send HTML mail issue

Post by Fidbeck »

That's what I thought but it shows as error lol

Is there any other place to do that?
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Jacek's send HTML mail issue

Post by jacek »

Fidbeck wrote:That's what I thought but it shows as error lol

Is there any other place to do that?

Just try the script locally and see what the result is, a website is never going to produce a better error than php can :D
Image
Fidbeck
Posts: 147
Joined: Tue Sep 25, 2012 11:40 pm

Re: Jacek's send HTML mail issue

Post by Fidbeck »

I'm having some problems with that lol
I use Dreamweaver CS6 and is not configured to run PHP files... I also use WebMatrix and when I run my contact it gives me a 404.20 HTTP error page...
HTTP Error 404.20 - Not Found


some time ago I had Wamp but had to delete it because the port :80 was already being used (maybe by WebMatrix) and I couldn't make it work properly.
User avatar
Temor
Posts: 1186
Joined: Thu May 05, 2011 8:04 pm

Re: Jacek's send HTML mail issue

Post by Temor »

Fidbeck wrote:I'm having some problems with that lol
I use Dreamweaver CS6 and is not configured to run PHP files... I also use WebMatrix and when I run my contact it gives me a 404.20 HTTP error page...
HTTP Error 404.20 - Not Found


some time ago I had Wamp but had to delete it because the port :80 was already being used (maybe by WebMatrix) and I couldn't make it work properly.


It's usually skype that occupies port 80, but it could also be Pando media booster or TeamViewer. Check for any of those under the processing tab in your task manager.
Fidbeck
Posts: 147
Joined: Tue Sep 25, 2012 11:40 pm

Re: Jacek's send HTML mail issue

Post by Fidbeck »

The thing is that I never, ever had any of those programs installed
User avatar
Temor
Posts: 1186
Joined: Thu May 05, 2011 8:04 pm

Re: Jacek's send HTML mail issue

Post by Temor »

pando media booster isn't a program you install. it comes with lots of different games to enhance performance. it's not visible unless you look in the process tab in your task manager.
Fidbeck
Posts: 147
Joined: Tue Sep 25, 2012 11:40 pm

Re: Jacek's send HTML mail issue

Post by Fidbeck »

This is all I have opened for now.
Image
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Jacek's send HTML mail issue

Post by jacek »

You can try XAMPP it's the easiest way I know of to set up a local testing thingy.
Image
Fidbeck
Posts: 147
Joined: Tue Sep 25, 2012 11:40 pm

Re: Jacek's send HTML mail issue

Post by Fidbeck »

I've already tried XAMPP in the past but since I couldn't make it work because the port it was listening was port 80 and it seems that that port was already being used. In a near future will format my HD so i'll install it then.
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Jacek's send HTML mail issue

Post by jacek »

Fidbeck wrote:I've already tried XAMPP in the past but since I couldn't make it work because the port it was listening was port 80 and it seems that that port was already being used. In a near future will format my HD so i'll install it then.

You should be able to edit the port it uses if you can find the config files for Apache, there will be something like

[syntax=text]Listen 80[/syntax]
somewhere, just change that to an unused port.
Image
Fidbeck
Posts: 147
Joined: Tue Sep 25, 2012 11:40 pm

Re: Jacek's send HTML mail issue

Post by Fidbeck »

I only changed in the httpd.conf file everything related to any port, being the listen or for instance 127.0.0.1:80
but i'm going to format my computer in a near future so i'll try that out. In another computer I have I don't have Webmatrix or Dreamweaver installed and Xampp works nicely. I bet it's Webmatrix that is ruining this stuff
Post Reply