Sending HTML Emails In PHP
I have a form that my customers can complete, and based on their answers, a results page will display. There are many if/elses in the page to display the proper results based on their answers. This works beautifully.
Now my problem:
I'd like to send them an email with their answers. I'm using the mail() function, and it works fine sending them the email in HTML format when I put static text in there like "Hello World!". However, I need to be able to perform if/then statements and include files into that email based on their answers. I can't get the includes to work at all.
Can anyone offer me some insight here?
View Complete Forum Thread with Replies
Related Forum Messages:
PHP Sending HTML Formatted Emails
Just so this is out there on the web, I battled the past 24 hours about this. Background info... I developed a ecommerce website in PHP 4 on a shared linux hosting plan from GoDaddy and had the html formatted emails sending as text/html and were going fine with limited header information. Then we moved the site over to a Dedicated Linux hosting plan. This time, it's PHP 5. Things are bound to not work as expected moving to a new programming language. So what worked in PHP 4: $headers = 'MIME-Version: 1.0' . ""; $headers .= 'Content-type: text/html; charset=iso-8859-1' . ""; Now needs to be (at least what worked for me) in PHP 5 $headers = "MIME-Version: 1.0"; $headers .= "Content-type: text/html; charset=iso-8859-1"; $headers .= "X-Priority: 3"; $headers .= "X-MSMail-Priority: Normal"; $headers .= "X-Mailer: php"; For the life of me I could not figure out why text/html formatted emails were always sending as plain text and all the information was shown in the body text using the PHP 4 method.
View Replies !
Sending Html Emails With Attachments
I'm using PHP 4.4.4 Can anyone recommend any good freeware that will allow me to send an HTML formatted email with an attachment? The attachment will also be an HTML file, but it would still be good to have a class/script that allows different attachment types. A key thing here is that the email is able to be viewed in Outlook.
View Replies !
Sending Multipart Html Emails With PHP Script
After hours of attempts and "googling", I'm still pulling my hair off my head when I try to send multipart html emails. It "works" on PCs with Outlook when I juste send a single "related" mail: one part for the HTML body, and several for the images. However, the images do not show on a Mac. I also wanted to have an "alternate", plain text message. I've tried the method described by Zend and PHPBuilder, but no luck... I've included a sample of what the email looks like in the end. Questions: what is the best way to organize the multiparts? Where does the header stop and the message start ? MIME-Version: 1.0 From: "Me" <me@truc.net> Subject: My subject Content-Type: multipart/alternative; boundary="PIEALT57206" This is a mulipart message in mime format --PIEALT57206 Content-Type: text/plain;Content-Transfer-Encoding: 8bit; charset="iso-8859-1" Your mail software is not HTML.... --PIEALT57206 Content-Type: multipart/related; boundary="PIEREL57206" --PIEREL57206 Content-Type: text/html Content-Transfer-Encoding:8bit (html code here) --PIEREL57206 Content-Type: image/jpeg; name="logo.jpg" Content-Transfer-Encoding: base64 Content-Description: "Image num.9" Content-ID: Image9
View Replies !
Some Problems With HTML Emails My PHP Site Is Sending
I'm creating HTML emails from a PHP site and sending them out to an email list (just about 40 people so far are on this list). I've tested and confirmed that these emails work in yahoo.com's webmail. And I know they work on *my* Outlook Express. But I have one person (I know of) who gets the emails as plain text, so she sees the HTML code for the email instead of its proper representation. She has, like myself, OE6, and other html emails (not necessarily the emails that come from my site, but HTML emails I've sent her directly with my OE), have worked OK. I can't figure it out. I've checked the headers in the emails I've sent her where it came out as plain text (she forwarded them back to me), and the "Content-type: text/html; charset=iso-8859-1" line is present, so it's not a missing header line.
View Replies !
Sending Out 26,000 Emails - How!?!
I need to send out 26,000 emails - on a regular basis... however, this consumes quite some time and I need to find a way to execute the PHP scriptm, without a timeout and without the user ahving to wait for it (at a rate of 10 emails/second, it's still 70 minutes).
View Replies !
Sending 2 Emails At Once
I'm using the following line in a PHP script, to send a visitor an email from my web page. The $_POST['email'] variable is whatever they enter as their email address into a form: mail ($_POST['email'], 'Title ', $body); I also would like the same script to send a little email to me at the same time, with a short message to myself - not the main body variable shown above. Could anyone please explain what I should add into the above code? All I really want is to receive their email address.
View Replies !
Sending Emails
My Hosting Service only allows me to send 250 emails/hour so I send an email every 15 seconds when sending a newsletter. I use a cron job to start the script at 9am and it should keep this script running until it finishes 10 000 emails(newsletter subscribers). After sending each email I log this in a MySQL db. And in my monitor I see that it stops after sending a various number of emails: 100, 400, 1000, 2300 or whatever(it never send all the 10000 emails). I have set up the maximum execution time variable to 0. Still, I have no idea: why does my emailing script stop? I've watched it myself a couple of times. It shows me no error. The browser just stops from loading after sending a number of emails. (error_reporting is set to 53 - no notices - notices shouldn't stop the script) Also, I have set the abort_user_ignore variable to true.
View Replies !
Sending Too Many Emails
I have a script that takes information from one table (ufJoin) and using its results grabs information from two other tables (users and feeds). Using the information gathered then utilizes a pre-made function and sends an email. For example: ufJoin contains userid 1 and feedid 1. So the script looks in the users table for the userid matching 1 and takes their email addresses. The script then looks in the feeds table for the feedid matching 1 and takes its url. The table ufJoin will contain more than one entry per user. Meaning, more than one URL is to be used. The URLs found are then attached to a pre-made function and emailed. It sends a new email for every URL instead of just the one! How can I stop this from happening?
View Replies !
Sending Multiple Emails
I have a little problem with sending multiple e-mails to multiple people. I can't just add recipients onto the "To:" because each e-mail will be different for each person I am sending to. I have a page sending me multiple variables that relate to different users. Then I go through those variables with a loop, get the related e-mail address, get other info related to that person and other info relating to that variable out of the database and try to send it. It seems to do it and I even get a mailsent - i.e. $mailsent = mail(); - of 1 for all of them, but only the first email ever gets sent. PHP Code:
View Replies !
Sending Lots Of Emails
Is there anything I should note when sending emails to lots of people from a database. i.e. do I need to stop the script to allow the server to send the mails or anything like that? I am running PHP on Linux, and am looking to send out approximately 12,000 emails. I'm using a web form to populate the email, then just the normal mail function to send, looping round once for each email (i.e. a separate call to mail() ).
View Replies !
Sending Emails (locally).
is anyone familiar with WAMP5 or the like? for building and testing php/mysql applications locally. This is basically how I build my site, and it would save a lot of trouble if I could build and properly test emails locally and not need to upload to my web host just for it to work. I use the mail() function.
View Replies !
Server Isn't Sending Emails
It's not a problem with a specific email service. There are people from hotmail, gmail, aol, yahoo and a few others who haven't received the validation link, but others with the same email service have. I have signed up with 2 of my gmail accounts and my hotmail account and I received the validation email each time, and it never shows up in the spam folder. When I set-up the domain on the server I did nothing to the mail server settings, I just left it with the default settings and it seemed to be working fine, but obviously not. I don't know jack about mail servers, so is there something I need to do to make sure all email are being sent? Code:
View Replies !
Mail() Sending Two Same Emails
<?php $mymail = '*******'; $mymail2 = "******"; $cc = $_POST['subject']; $FrOm = $_POST['email']; $BoDy .= 'First Name: '; $BoDy .= $_POST['first_name']; $BoDy .= ""; $BoDy .= 'Last Name: '; $BoDy .= $_POST['last_name']; $BoDy .= ""; $BoDy .= 'Email: '; $BoDy .= $_POST['email']; $BoDy .= ""; $BoDy .= 'Message: '; $BoDy .= $_POST['message']; $BoDy .= ""; $send = mail("$mymail", "$cc", "$BoDy", "From: $FrOm"); $send2 = mail("$mymail2", "$cc", "$BoDy", "From: $FrOm"); if ( $_POST['subject'] == "Lunches"){ $send2; } if($send2){ echo '<html><head>'; echo '<meta http-equiv="refresh" content="0;URL=contactus_return.html">'; echo '</head><body>Sending, Please hold...'; echo '</body></html>'; } else { ($send); } if($send) { echo '<html><head>'; echo '<meta http-equiv="refresh" content="0;URL=contactus_return.html">'; echo '</head><body>Sending, Please hold...'; echo '</body></html>'; } ?> When there is Lunches or any other value it sends both emails mymail and mymail2 are active and both send emails. Where is my mistake?
View Replies !
Sending Emails With Delay
i have 300 subscribers. According to my hostings provider mail policy, i can send 200 emails in one hour. So its 18sec/1email. So what are my possibilities? 1. I can send emails using set_time_limit(0) + sleep(20). 2. Set some cronjob. Using first method, would force me to have browser window opened for ~1.5h... Not an option. So i guess using cronjobs would be the best thing to do here. But how to invoke/destroy cronjobs from a PHP script. I dont have any shell acc and safe_mode is on.
View Replies !
Sending 1000 Emails ?
I have a small problem : i want to send emails to 1000 users ( or more , and i will do it very fluently ) , i just want to use pure PHP . What should i do to solve this problem ? If i send 1000 mails at a time , will there have any problems ?
View Replies !
Sending Bulk Emails
I'm trying to send a lot of emails from my PHP script. I'm using PHPmailer. I tried to send 1000 emails but only managed to send about 600 of them. So my question for the forum is How do I send lots of emails? Are there different methods? I do not want to send one email with 1000 email addresses. I want to send 1000 unique emails.
View Replies !
Sending Blank Emails
I have the following code $to=$email; $from="thankyou@m.com"; $body="dfasdfasdfd safdsaf"; $title="Thank You for shopping at M.com"; $success = mail($to,$from,$title,$body,"From:$from Reply-To:thankyou@m.com"); for some reason it is not sending the email. I don't get any error but if I do echo $success - then it's blank. Did i do something wrong?
View Replies !
Hotmail Sending My Emails
Ive been working on getting email sent that don't send directly to junk mail for a while now. So far i have my emails getting sent to the inbox of gmail , outlook, yahoo accounts. However im still having trouble with HOTMAIL. Ive been reading around and there seems to be increased settings for hotmail but have yet to be able to configure my system for these.
View Replies !
Pause In Between Sending 50 Emails At A Time
I am planning to send opt-in emails by chuncks of 30 to 50 at a time and would like pausing between each chunks 1) is using sleep() feasable or using:? 2) how long should I set the sleep for? (it will never be over a grand total of +/- 200 emails)
View Replies !
Sending Lots Of Emails In The BACKGROUND?
I'm building a 'job posting' site of sorts. When a job is available in a particular state, I want the system to send an email to everyone who is 'watching' that state. I know how to do this, but I need to figure out a way to 'send the emails in the background' - ie: if an administrator adds a job to Wyoming, I don't want them to have to wait for the php script to finish selecting and e- mailing everyone watching the state before the administrator can move on and do other things. I originally thought that passing this task to the PHP command line would do the trick, but it turns out that a script like... exec("my php script that emails people"); echo "complete!"; ....does not echo "complete!" until the thousands of people have all had their info passed to the mail server (a long time). I suppose that I could get rid of this by just lumping everyone together in the Bcc: field of a single e-mail message, but at this point I'd like to keep that as a last resort and go with the personalization ("Hi James... a job has been posted in Wyoming"). Does anyone have any thoughts as to how I can send the emails without preventing the administrator from doing other tasks until the script has finished executing?
View Replies !
Stop Cron From Sending Me Emails?
How can I stop Cron from sending me emails? I tried to make the program run without output but it's still sending an email. I heard there was the other method, to make the output go to a file. How can I do this?
View Replies !
Sending Emails To Database List
im trying to add on somewhat of a newsletter feature onto a website. Basically I have a list of email addresses (along with their first and last names) in mysql database. From here ive created a form, simply its one text box, in which the administrator will type their text into this text box, press submit and the email will be sent to all those in the database. The part in red (the actual email sending bit) works only if I was sending to one person. But for some reason it doesnt like to looped and used for each row of data (ie each email sending attempt). (edit, the code below doesnt seem to want to go red, but you can see where its ment to!) Code:
View Replies !
Newline Characters And Not Sending Emails Out
I am using a simple mail script to send out emails for a webpage that I designed. The script works fine until I insert the newline character ( ). Anytime I insert it, the webpage runs fine but no email is sent out. As soon as I take the newline character out of the mail script, emails are sent out just fine. Code:
View Replies !
Mail Function Not Sending Emails.
im starting to doubt my ability to read the php manual. Somehow this thing is not sending emails. Any thoughts why? (Yes i did change mymail@mail.com into an actual email address. mail('mymail@mail.com', 'My Subject', 'my message');
View Replies !
Sending Emails To A Large Group
I have written a script to send an email to a large list of emails, it works fine except for one slightly major thing. Each email needs to have the receipient's email address at the bottom of the message for removal purposes. This requires crafting a seperate email for each person. And therefore I must send an individual email for each person. The problem is rate. I need to know how I can rate limit the outgoing messages, and/or make my mta (exim) send lots of messages in one connection (up to 50 per connection).
View Replies !
Script Stopped Sending Emails
PHP Code: Function SendMail($to,$subject,&$body,&$headers) { Â Â $return_path=""; Â Â if(IsSet($this->delivery["Headers"])) Â Â { Â Â Â $headers_values=$this->delivery["Headers"]; Â Â Â for($header=0,Reset($headers_values);$header<count($headers_values);$header++,Next($headers_values)) Â Â Â { Â Â Â Â if(strtolower(Key($headers_values))=="return-path") Â Â Â Â { Â Â Â Â Â $return_path=$headers_values[Key($headers_values)];
View Replies !
Sending Mail: Choice Between Sending Receipt, Or HTML Formatting
I'm using PHP's mail function to send out a message via email. I would like for this email message to send a receipt when read as well as send an HTML formatted email. Both aspects are important to me. I know this is a product of the mail header. This is the format I currently have: mail(to, subject, body, "From: name <email> Disposition-Notification-To: name<email> Content-type:text/html;charset=utf-8"); This prompts the email program to send a reciept, but the email message is not in the HTML format, and even contains "Content-type:text/html;charset=utf-8" at the top of the body. If I switch the order to this format: mail(to, subject, body, "From: name <email> Content-type:text/html;charset=utf-8 Disposition-Notification-To: name<email>"); This sends the email with HTML formatting but does not prompt the sending of the receipt. I also get "Disposition-Notification-To: name<email>" at the top of the email message. This tells me there is a problem in the transition between the headers, which currently is "". What am I doing wrong?
View Replies !
Mail() Function Sending Emails Trapped By IMF
I am using the simple mail() fucntion in a php script but the emails that are being generated and being trapped by Microsoft Exchange server 2003 Inteligent message filter as having an SCL rating of 7 or 8, the highest possible being 9. This is causing me problems getting the emails delivered to people!
View Replies !
Sending Emails To Email Addresses In A Database
Basically have a customer sign up form a site, where they can check a box to say they want to receive updates / offers etc. So what I'm looking to do is enable the site owner to send emails to all those who have done so from the site. ie get addresses from the email field in the cutomers table where the value of the receiveUpdates field = yes. How would it typically work exactly - I imagine a form on a page where the owner can type in a title and message, hit a button that actions a php page that retrieves the correct records, and sends out the email.
View Replies !
Problem With Sending Mutliple BUT Personalised Emails...
My problem as the title states is sending multiple emails that have to be personalised. Now, being dumb when it somes to creating email and having 0 (zero) knowledge of the email servers I started using phpmailer class to achieve what I need in this mailing list I created out of customers of my clent's site.. Code:
View Replies !
Mail Function Sending Double Emails
I have a script I'm using to send me e-mails when someone registers for an event I'm holding. But it's sending the e-mails twice. How can I fix this? Can anyone help? My host uses qmail. I get no errors reported. Here is the function as I'm using it: mail('address1@host, address2@host', $subject, $messageproper, "From: "$yourname" <$email> X-Sender: My site name" ); I have a value passed to the variables "yourname", "subject", "messageproper", "email" from a form I've set up. Any ideas what's causing the double emails and how to solve this problem?
View Replies !
Sending Individualised Emails From A Remote Server
I have been trying for several days to develop a mass email system which can handle HTML content, can mail out to multiple addresses and where I can individualise the content using each recipient's first name (Dear John). I was recommended phpMailer which seems to offer everything I needed but I could not get it to connect (via SMTP) to the remote mail server I am using. I then tried htmlMimeMail which also did everything I needed. I got it up and running, but when I tried to loop through the recipents addresses adding each recipients name to the body of the email the inbuilt function could not execute fast enough to keep up with the loop. Hence emails were sent to each recipient but each had the same name in the body, the first in the array.
View Replies !
Mass Mailing - Sending SMTP Emails Via PHP Page
I am sending SMTP emails via my PHP page, I am sending about 20 SMTP emails (stress testing) one after another, these emails are sent via a FOR loop (has one MySQL seek for email address in each loop)(with NO forced delay what so ever). Code:
View Replies !
Upload An Image Update The Cach...and Sending Emails...
In my site I have it so users can upload images of themselves. After I upload a new image, it still shows the old one until I hit refresh. Is there any way to update the cache so the new image is automatically shown and you don't have to hit refresh? Second question. In my site I have a confirmation email system. When I send the email to some mail systems, it is automatically sent to their spam folder. What measures can I take to ensure my emails aren't seen as spam?
View Replies !
Html In Emails
I am having some trouble with html and emails. I have this script which is suppost to send a html email, although the html is just appearing in plain text. PHP Code:
View Replies !
HTML Emails
I have made a simple form that sends the message in an email etc etc but was wondering (im a bit of a newbie) how to make the email html? What im doing is i have a form that sends info to another script that sends the email, using mail() etc.
View Replies !
Send HTML Emails?
How can i make it where my script below can send html emails? Right now it works, it sends emails, but how can i make it so it can send html emails Code:
View Replies !
Send Html Emails
I can send html within an email which is good, but can get a little tricky if I want to print it out in a nice format, because many email programs don't support html or mess up the layout to say the least. What I'd like to do Take that html code, which I send in an email, but instead of simply displaying it, attach it as a file. either as it's own seperate .html file or even a pdf or something. Does anyone know if this can be done?
View Replies !
Images In Html Emails
I have created a php script which sends an html email and I'm trying to include an image within this html email using the following lines in the body variable: $body = "<table cellpadding=2 cellspacing=0> <tr bgcolor=#9E0221> <td bgcolor=#9E0221 valign=center><br><font face=georgia size=2 color=#FFFFFF><b>Valentine Hint</b> </font></td> <td valign=center><br><img src=images/be_my_valentine.gif><br><br></td> </tr> </table>" The email gets sent successfully and is formatted find, but the image doesn't appear. I have tried putting the gif in the same directory as the php script as I thought there might be a problem with the slash in the path. But that doesn't work either.
View Replies !
Create HTML Emails
I've been trying to create HTML emails but when i receive the email created by this script the link comes out as text do anyone have any idea why this might be? and what apoach would be best to solve it. Code:
View Replies !
Help Formatting HTML Emails Using Sendmail
A client of mine requires the ability to send out HTML formatted emails after a database post. When I send the email out to yahoo or hotmail, the actual HTML tags are visibile. Using these same yahoo and hotmail accounts, i can view emails from other providers that are formatted with HTML, so this tells me my code is wrong. PHP Code:
View Replies !
Send HTML Mime Emails
I have tried several codes to send HTML code and I can't. Can somebody pls put a COPY and PASTE PHP code for sending HTML mailers that I can easily modify.
View Replies !
Form Script, Html Emails?
So I have this form script working, but whenever I mess around with headers it doesn't send the email any more. I'm looking to simply add one image into the top of the email. When I try to even add headers to get a From address and a reply to the email just doesn't send at all. So I haven't even messed with adding an image from my server, but I assume it just involves adding an img src tag to the beggining of my $message variable? Here's my code I'm using to try to send an html email via Post:
View Replies !
|