472,364 Members | 2,171 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,364 software developers and data experts.

sending email with php

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. $headers = "Content-type: text/html; charset=iso-8859-1";
  4. $to="myemailaddress";
  5. $subject="Email Newsletter";
  6.  
  7. $message = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  8. <html xmlns="http://www.w3.org/1999/xhtml">
  9. <head>
  10. <title>Email Newsletter</title>
  11. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  12. <meta name="robots" content="noindex, nofollow" />
  13. <link rel="stylesheet" type="text/css" href="style.css" />
  14. </head>
  15.  
  16. <body>
  17. <div id="wrapper">
  18.     <div id="topmenu">
  19.     </div>
  20.     <div id="content">
  21.         <div class="leftcolumn">
  22.         </div>
  23.         <div class="rightcolumn">
  24.         </div>
  25.     </div>
  26.     <div id="footer">
  27.     </div>
  28. </div>
  29. </body>
  30. </html>';
  31.  
  32. if(! mail($to, $subject, $message, $headers)){
  33.     echo "There was an error is sending the email";
  34.     }
  35.     else{
  36.     echo "The email has been sent";
  37.     }
  38. ?>
hi

my question is about send an email with php like a newsletter, when we read a newsletter email its similar to a webpage which contains content, images, css and other elements

i created a static webpage initially with html css and images folder after creating the page i wanted to test to see how it would look if i were to send this as an email like a newsletter.

so i have created a php file with
Expand|Select|Wrap|Line Numbers
  1. $headers = "Content-type: text/html; charset=iso-8859-1";
  2. $to="myemailaddress";
  3. $subject="Email Newsletter";
and
$message as mentioned above has the entire html code as i used it in my static html page
i also copied the style.css in the server and created images folder and copied all the images i used in my static page to the server.

i created a separate folder in my webserver called newsletter and copied the php file, css file and images folder with the images i used

when i accessed the index.php as http://website.com/emailnewsletter i am getting a message that The email has been sent and i am getting the email

however my question is when i open this email the styles and images are not being applied and i see only the text in the static page i created.


can someone let me know how i can fix this so that when i open the email it would look like the static page i created with all the styles applies and images displayed

is this only possible by using specialized email softwares or can it be done by php as well with the logic used.


any help will be appreciated.

thanks
Dec 23 '09 #1
1 1714
Dormilich
8,658 Expert Mod 8TB
try to use absolute URLs (like http://example.org/style.css)
Dec 24 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Paul Lamonby | last post by:
Hi, I am sending a file from the server as an email attachment. The file is being attached no problem and sending the email, but I get an error when I try to open it saying it is corrupt....
0
by: praba kar | last post by:
Dear All, I have doubt regarding mail sending smtplib module. The below code is I used to send a mail. ########################################## import email.Message import email.Utils...
3
by: VB Programmer | last post by:
I have an ASPX page where I send out emails through my mail server mail.MyDomain.com. When I send emails to MyName@MyDomain.com it sends PERFECTLY. When I try sending an email to any other address...
3
by: Ant | last post by:
Hi, I'm using the MailMessage & smtpMail classes in System.Web.Mail to send mail, however it's not sending any emails. I'm using it on a Windows 2003 server. The simplest way to use this is...
1
by: Eric Sheu | last post by:
Greetings, I have been searching the web like mad for a solution to my SMTP problem. I am using Windows Server 2003 and ASP.NET 2.0 w/ C# to send out e-mails from a web site I have created to...
2
by: =?Utf-8?B?QWRl?= | last post by:
HI All, I am encountering the following error when I try to send an email through a SMTP server. I believe the problem lies with the authentication part when the network crednetials are used,...
9
by: JoeP | last post by:
Hi All, How can I find the reason for such an error: Failure sending mail. Some Code... oMailMessage.IsBodyHtml = False oMailMessage.Body = cEmailBody Dim oSMTP As New SmtpClient...
7
by: bleachie | last post by:
Hey, I just need some help, my form seems to not send me all of the 'guestNames' and 'guestEmails' forms. i use this function to add more guestnames and guestemail fields based on the number of...
10
by: Markgoldin | last post by:
I am sending an XML data from not dontnet process to a .Net via socket listener. Here is a data sample: <VFPData> <serverdata> <coderun>updateFloor</coderun> <area>MD2</area>...
31
by: happyse27 | last post by:
Hi All, I am trying for weeks how to send email from windows pc, which from my gmail account to my hotmail account. Using net::smtp module sending email failed,Kindly assist. (for the item d it...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.