T-Shirt Forums banner

In need of a php /css genius!

1379 Views 14 Replies 4 Participants Last post by  funkymunky
Hi guys,
Not posted for a while as I have been recovering from a spot of ill health.
I have a problem. With my son I have been looking at our online presence which up until recently we used Big Cartel which was good but we were looking at a more reasonable solution.
We have now installed 'Opencart' it's not pretty nor functional at the moment. Our main problem is with the email side of things. On the 'Contact' page there is a form for the customer to fill in, the detail on this form when sent should come to my nominated email account, and it does! BUT, the customers email address is not sent with the original enquiry so I cannot reply to the enquiry:confused:
My son has put a full post up on a Forum that he uses I will link you to it in this thread as it contains the script that needs attention:
PHP Help regarding OpenCart - Overclockers UK Forums

As you can see my son has not received a great responce fom his forum. I have decided to post our plight here and hope someone can helps us sort this.

Many, many thanks in advance

Phil
1 - 15 of 15 Posts
SMTP doesn't really care about whom mail is sent from, I used to send e-mails as President Bush (senior) and Clinton with whitehouse domains and such to friends way back long ago.
Try changing:
ini_set("sendmail_from", "[email protected]");
to:
ini_set("sendmail_from", $this->sender);
i THINK that you should take this part of the code:
} else {
$to = $this->to;
}

if ($this->charset) {
$charset = $this->charset;
} else {
$charset = 'utf-8';
}
and change it to this:
} else {
$to = $this->to;
$from=$this->from;
}

if ($this->charset) {
$charset = $this->charset;
} else {
$charset = 'utf-8';
}
In my message, I'm thinking sender is the individual sending the request, it may also be "from" in this instance.

SMTP raw communication is as follows:
You connect to SMTP server
You issue "HELO"
Server acknowledges
You specify the sender's e-mail address (MAIL FROM:)
Server acknowledges
You specify the recipient's e-mail address (RCPT TO:), this user has to exist on that server
Server acknowledges
You specify text (DATA)
Then you typically close with a period.
See less See more
Thanks for the fast replies guys but still having problems:(
Every email that comes through states from '[email protected]' and does not quote the senders email address.

HELP!

Phil
Try this, find these lines:

$headers = 'X-Mailer: PHP/' . phpversion() . $eol;
$headers .= 'MIME-Version: 1.0' . $eol;
$headers .= 'Content-Type: multipart/mixed; boundary="' . $boundary . '"' . $eol . $eol;

Change it to:
$headers = 'From: ' . $this->from . $eol;
$headers .= 'X-Mailer: PHP/' . phpversion() . $eol;
$headers .= 'MIME-Version: 1.0' . $eol;
$headers .= 'Content-Type: multipart/mixed; boundary="' . $boundary . '"' . $eol . $eol;


Again, if $this->from is the user submitting the form's address, then use that, otherwise use $this->sender
See less See more
  • Like
Reactions: 1
Try this, find these lines:

$headers = 'X-Mailer: PHP/' . phpversion() . $eol;
$headers .= 'MIME-Version: 1.0' . $eol;
$headers .= 'Content-Type: multipart/mixed; boundary="' . $boundary . '"' . $eol . $eol;

Change it to:
$headers = 'From: ' . $this->from . $eol;
$headers .= 'X-Mailer: PHP/' . phpversion() . $eol;
$headers .= 'MIME-Version: 1.0' . $eol;
$headers .= 'Content-Type: multipart/mixed; boundary="' . $boundary . '"' . $eol . $eol;


Again, if $this->from is the user submitting the form's address, then use that, otherwise use $this->sender
Joe,
I'm forever grateful mate. It looks like you've done it!
Thank you

Phil
Hold on, put down the party whistles!
It now appears that when a new customer registers to my website the welcome email gets delivered to me and not them:confused:
Is this action dealt with in this script? If so can you see the error?

Thanks
Phil
Hold on, put down the party whistles!
It now appears that when a new customer registers to my website the welcome email gets delivered to me and not them:confused:
Is this action dealt with in this script? If so can you see the error?

Thanks
Phil
If they're using the same script, then it's due to the hardcoded values.

The following is from the original (before we recommended some changes):
ini_set("SMTP","smtp.flashtees.co.uk");
ini_set("smtp_port","25");
ini_set("sendmail_from", "[email protected]");
mail("[email protected]", $this->subject, $message, $headers);

It should probably be:
ini_set("SMTP","smtp.flashtees.co.uk");
ini_set("smtp_port","25");
ini_set("sendmail_from", $this->from);
mail($this->to, $this->subject, $message, $headers);

That way when the function is called there are no constant/hardcoded values. Of course, you will want to keep testing until everything's iron'ed out. A nice way to test is to include a dump of all the variables being used, so that way you can see where it's going awry.
See less See more
  • Like
Reactions: 1
If they're using the same script, then it's due to the hardcoded values.

The following is from the original (before we recommended some changes):
ini_set("SMTP","smtp.flashtees.co.uk");
ini_set("smtp_port","25");
ini_set("sendmail_from", "[email protected]");
mail("[email protected]", $this->subject, $message, $headers);

It should probably be:
ini_set("SMTP","smtp.flashtees.co.uk");
ini_set("smtp_port","25");
ini_set("sendmail_from", $this->from);
mail($this->to, $this->subject, $message, $headers);

That way when the function is called there are no constant/hardcoded values. Of course, you will want to keep testing until everything's iron'ed out. A nice way to test is to include a dump of all the variables being used, so that way you can see where it's going awry.
Joe,
Thanks again for your kind reply, I will try out your 'fix' later on and report back.

Phil
If they're using the same script, then it's due to the hardcoded values.

The following is from the original (before we recommended some changes):
ini_set("SMTP","smtp.flashtees.co.uk");
ini_set("smtp_port","25");
ini_set("sendmail_from", "[email protected]");
mail("[email protected]", $this->subject, $message, $headers);

It should probably be:
ini_set("SMTP","smtp.flashtees.co.uk");
ini_set("smtp_port","25");
ini_set("sendmail_from", $this->from);
mail($this->to, $this->subject, $message, $headers);
Joe,
That appears to have worked also! You are a genius my friend. Now I need to know if you are a computer genius who makes t-shirts or a genius t-shirt maker who knows his way around a computer?:D

Many, many thanks again for all your kind help.
Regards
Phil
The former, I was programming in x86 assembly language and C by the time I was 14. Got a bachelors degree in programming right after 9/11 and Y2K, when the tech market just went to complete crap. Now I'm 27 making many different things in my shop. Life always has a strange way of working out, I enjoy what I do, even if it wasn't my initial calling :)
The former, I was programming in x86 assembly language and C by the time I was 14. Got a bachelors degree in programming right after 9/11 and Y2K, when the tech market just went to complete crap. Now I'm 27 making many different things in my shop. Life always has a strange way of working out, I enjoy what I do, even if it wasn't my initial calling :)
Joe,
Well i'm the wrong side of 40 now and all your kind help read like Japanese to me:D But my son is a mere 16 years and doing a BTEC two year course at college from here he hopes to go on to University to do his Degree. Even with his knowlege and young head you have put him off programming he is now looking down the 'Networking' route.
I agree with your 'Life has a strange way of working out' comment, oh so true!
The best advice I could give anybody, do what makes you happy!
Thanks again Joe, you're a star;)

Phil
Props to Joe for free coding advice!!
Here, Here! Daddy
1 - 15 of 15 Posts
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top