943,396 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 109590
  • PHP RSS
You are currently viewing page 1 of this multi-page discussion thread
May 13th, 2003
0

Sending HTML email via PHP mail function

Expand Post »
I've got a basic subscription list signup for a website, and a basic form to input the text for sending an email to the subscribers... but I need to know what steps I need to take to create an HTML email, place a different main topic in the newsletter each month, and still have it available to view from the site at a later time....

Can anyone help?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
jessa_lee is offline Offline
1 posts
since May 2003
May 14th, 2003
0
Re: Sending HTML email via PHP mail function
I'm not sure exactly how extensive your knowledge is of PHP or how much you've done so far. Since you say this is written in PHP (or you want it to be) I take it you are working on a *Nix platform? Do you have sendmail configured on the server? A database set up to keep track of subscriptions as well as prior newsletters?
Administrator
Staff Writer
Reputation Points: 1422
Solved Threads: 162
The Queen of DaniWeb
cscgal is offline Offline
13,645 posts
since Feb 2002
Jul 21st, 2003
0

Re: Sending HTML email via PHP mail function

You must give content type see the example below:

mail($to, $object, $message, "From: $from\nReply-To: $from\nContent-Type: text/html;
8)
Reputation Points: 10
Solved Threads: 0
Newbie Poster
MIQuebec.NET is offline Offline
1 posts
since Jul 2003
Jul 23rd, 2003
0

Re: Sending HTML email via PHP mail function

Quote originally posted by MIQuebec.NET ...
You must give content type see the example below:

mail($to, $object, $message, "From: $from\nReply-To: $from\nContent-Type: text/html;
8)
Isn't there a " between the
PHP Syntax (Toggle Plain Text)
  1. text/html;
and the
PHP Syntax (Toggle Plain Text)
  1. );
?
Team Colleague
Reputation Points: 63
Solved Threads: 6
Supreme Evil Overlord
Roberdin is offline Offline
282 posts
since Feb 2003
Oct 20th, 2003
0

Re: Sending HTML email via PHP mail function

if you want to send HTML emails via PHP you should consider reading this article: http://www.phpbuilder.com/columns/kartic20000807.php3

I know it will help ;) cheers.-
Reputation Points: 10
Solved Threads: 0
Newbie Poster
OceanSurf is offline Offline
2 posts
since Oct 2003
May 20th, 2006
0

Re: Sending HTML email via PHP mail function

This is how I send HTML email in my PHP Contact Form demo located at :
http://programmers-paradise.net/demo...ct/contact.php

The send email code is :
[php]@mail($to, $subject, $message, "From: $from\nContent-Type: text/html; charset=iso-8859-1");[/php]

You can download the Contact Form at:
http://programmers-paradise.net/pafi...tion=file&id=3

Reputation Points: 17
Solved Threads: 8
Junior Poster in Training
Banderson is offline Offline
66 posts
since Aug 2004
May 20th, 2006
0

Re: Sending HTML email via PHP mail function

Quote originally posted by jessa_lee ...
I've got a basic subscription list signup for a website, and a basic form to input the text for sending an email to the subscribers... but I need to know what steps I need to take to create an HTML email, place a different main topic in the newsletter each month, and still have it available to view from the site at a later time....

Can anyone help?
I would suggest that you are use a PHP script already made to send your newsletter. Please also note that you have a very long email list, it is not a good idea to spend all the emails at the same time. You should include delays between sending x amount of emails.
This is because most hosting companies look out for accounts that sent a huge number of emails in a short period time. They identify such accounts as spammers and your account might get displayed.

You can find scripts that would handle that for you on hotscripts.com rather than spending a lot of time writting your own script and re-inventing the wheel.
Reputation Points: 10
Solved Threads: 5
Junior Poster
alpha2006 is offline Offline
116 posts
since Apr 2006
Apr 5th, 2007
0

Re: Sending HTML email via PHP mail function

Click to Expand / Collapse  Quote originally posted by cscgal ...
I'm not sure exactly how extensive your knowledge is of PHP or how much you've done so far. Since you say this is written in PHP (or you want it to be) I take it you are working on a *Nix platform? Do you have sendmail configured on the server? A database set up to keep track of subscriptions as well as prior newsletters?
First, I am "jessa_lee" - though now married and I hadn't realized I had a username on DaniWeb when I created my new one My knowledge of PHP is limited, and the site is written with PHP. I already had the sendmail function set up on the site (4 years ago). What I wanted was for the client to be able to type up a newsletter and click submit, and for the PHP to do two things. 1) Send out the newsletter to all the subscribers (which it was already doing), and 2) store the fully typed newsletter in the MySQL DB for viewers to pull it up on the site. I also had the side of the site setup to view past newsletters... but the "create a newsletter archive" form was a seperate page from the "send a new newsletter" form and I didn't know what I needed to do to merge the two forms and have the script tell it to do both steps 1 and 2...

Does that make sense? I no longer run a web business, but I guess if there are others who would reference this posting for answers, I'd love any feedback (and to finally know for myself how to do it). Thank you for those of you who did post back when I requested - DaniWeb is AWESOME!
Last edited by jlillge; Apr 5th, 2007 at 2:19 pm. Reason: Noted username change :)
Reputation Points: 10
Solved Threads: 0
Newbie Poster
jlillge is offline Offline
2 posts
since Jan 2007
Apr 6th, 2007
0

Re: Sending HTML email via PHP mail function

There are all kinds of downloadable software in the web site.http://www.qweas.com/
With a strong search engine, you will find many software with discount or even free price.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Cstrikedish is offline Offline
1 posts
since Feb 2007
May 19th, 2010
0
Re: Sending HTML email via PHP mail function
use

mail($to, $subject, $message,string $additional_headers,string $additional_parameters);

use $subejct and $message as database driven (which will change every month based on date)
in additional parameter use "-f themailid@domainname.com"
so that is escapes all filters


for guide on creating newsletter refer:
http://www.knowledge-transfers.com/i...tml-newsletter
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Prithwirajsaha8 is offline Offline
6 posts
since May 2010

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Sessions and updating question??
Next Thread in PHP Forum Timeline: PHP Multiple fetch array. Problems!





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC