php mailto () fuction

Reply

Join Date: Feb 2008
Posts: 347
Reputation: kevin wood is an unknown quantity at this point 
Solved Threads: 1
kevin wood's Avatar
kevin wood kevin wood is offline Offline
Posting Whiz

php mailto () fuction

 
0
  #1
Apr 4th, 2008
can this be used to email a php page to a mailing list using a submit button?
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,678
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 319
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: php mailto () fuction

 
0
  #2
Apr 4th, 2008
You can use php's mail function..
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 347
Reputation: kevin wood is an unknown quantity at this point 
Solved Threads: 1
kevin wood's Avatar
kevin wood kevin wood is offline Offline
Posting Whiz

Re: php mailto () fuction

 
0
  #3
Apr 4th, 2008
the page was set up so it uses the mail() function but it does not like the mysql in the code when the page is being created it just keeps throwing up errors.

the code that was originally created looks like this

  1. <?php
  2. // construct mailing list array
  3. $merc_list = explode(",",$merc_mailingList);
  4.  
  5. // deploy the emails
  6. for($i=0; $i<count($merc_list); $i++){
  7. $message = "<style type=\"text/css\">body { margin: 0; background: ; background-image: url(); background-repeat: no-repeat;
  8. } .mainTxt {font-size: 11px; color:#444444; font-family: Arial, Helvetica, sans;} .whiteTxt {font-size: 9px; color:#FFFFFF; font-family: Arial, Helvetica, sans;} a:link {color:#EB7324} ul {font-size: 9px; color:#EB7324;padding-left: 5px;}
  9. .style3 {font-family: Geneva, Arial, Helvetica, sans-serif; color: #FFFFFF; font-weight: bold; }
  10. .style1 {font-family: Arial, Helvetica, sans-serif; font-size: 10px;color: #666666;}
  11. </style>";
  12.  
  13. $message .= "<body leftmargin=\"0\" topmargin=\"0\">
  14. <table width=\"900\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"5\">
  15. <tr>
  16. <td height=\"95\" colspan=\"2\" scope=\"col\"><img src=http://acmeart.co.uk/mercury/layout/BroadsheetSample/broadhead.jpg width=\"900\" height=\"150\" /></td>
  17. </tr>
  18. <tr>
  19. <td height=\"25\" colspan=\"2\" scope=\"col\"><span class=\"mainTxt\"><strong>$broad_topictitle1</strong></span></td>
  20. </tr>
  21. <tr>
  22. <th width=\"23%\" height=\"200\" scope=\"col\"><div align=\"left\">
  23. <?php
  24.  
  25. $query = "SELECT broad1 FROM images_broad";
  26. $result=mysql_query($query);
  27.  
  28. while($row=mysql_fetch_array($result, MYSQL_ASSOC)){
  29. echo '<img src="'.$row['broad1'].'"/>';
  30. }
  31.  
  32. ?>
  33. <p>&nbsp;</p></div></th>
  34. <td width=\"77%\" scope=\"col\"><table width=\"99%\" border=\"0\" cellpadding=\"10\" cellspacing=\"0\">
  35. <tr>
  36. <td align=\"left\" valign=\"top\"><span class=\"mainTxt\">$broad_messagebody1</span></td>
  37. <!-- End Image 1 -->
  38. </tr>
  39. </table>
  40. <p>&nbsp;</p>
  41. <p>&nbsp;</p>
  42. <p>&nbsp;</p>
  43. <p>&nbsp;</p></td>
  44. </tr>
  45. <tr>
  46. <td height=\"28\" colspan=\"2\" scope=\"col\"><span class=\"mainTxt\"><strong>$broad_topictitle2</strong></span></td>
  47. </tr>
  48. <tr>
  49. <th height=\"95\" scope=\"col\"><div align=\"left\"><img src=\"http://acmeart.co.uk/mercury/layout/BroadsheetSample/broad2.jpg\" width=\"200\" height=\"200\" /><p>&nbsp;</p></div></th>
  50. <td scope=\"col\"><table width=\"99%\" border=\"0\" cellpadding=\"10\" cellspacing=\"0\">
  51. <tr>
  52. <td align=\"left\" valign=\"top\"><span class=\"mainTxt\">$broad_messagebody2</span></td>
  53. <!-- End Image 1 -->
  54. </tr>
  55. </table>
  56. <p>&nbsp;</p>
  57. <p>&nbsp;</p>
  58. <p>&nbsp;</p>
  59. <p>&nbsp;</p></td>
  60. </tr>
  61. <tr>
  62. <td colspan=\"2\" scope=\"col\"><img src=\"http://acmeart.co.uk/mercury/layout/BroadsheetSample/broadfoot.jpg\" width=\"900\" height=\"150\" /></td>
  63. </tr>
  64.  
  65. <tr>
  66. <td height=\"13\" colspan=\"2\" scope=\"col\"><div align=\"justify\"><span class=\"style1\">Linacre Voice is a monthly bulletin from LinacreOne Community Partnership 140-142 Linacre Road Litherland L21 8JU Tel: (0151) 922 4898 Open Monday - Thursday 10:00am - 4:00pm <font size=\"1\"></font></span> </div></td>
  67. </tr>
  68. </table>
  69. </table>
  70. </body>";
  71.  
  72.  
  73.  
  74. // Contacts
  75. $replyName = "$merc_replyId";
  76. $replyEmail = "$merc_replyAddress";
  77.  
  78. $contactname = "";
  79. $contactemail = "$merc_list[$i]";
  80.  
  81. // Subject
  82. $subject = "$merc_messageTitle";
  83.  
  84. // Headers
  85. $headers = "MIME-Version: 1.0\r\n";
  86. $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
  87. $headers .= "From: ".$replyName." <".$replyEmail.">\r\n";
  88. $headers .= "To: ".$contactname." <".$contactemail.">\r\n";
  89.  
  90. mail($contactemail, $subject, $message, $headers);
  91. } // END for
  92.  
  93. ?>

i was playing about with this before to see if i could get it to load the page without it being coded again to get round the mysql problem. with the code like this it will not display the images and the code dies when it gets to the mysql.

this is another page which was already meant to be set up according to the lad who was working on it before me.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,678
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 319
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: php mailto () fuction

 
0
  #4
Apr 4th, 2008
You can't have
<?php

$query = "SELECT broad1 FROM images_broad";
$result=mysql_query($query);

while($row=mysql_fetch_array($result, MYSQL_ASSOC)){
echo '<img src="'.$row['broad1'].'"/>';
}

?>
in $message. Since it is already a php variable. Assign only the <img src value to $message. Then try again. That will surely fix one of your problems.
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 347
Reputation: kevin wood is an unknown quantity at this point 
Solved Threads: 1
kevin wood's Avatar
kevin wood kevin wood is offline Offline
Posting Whiz

Re: php mailto () fuction

 
0
  #5
Apr 4th, 2008
the $message variable is set to be the information that is sent out so before this is set could i set more variables to be the images and then set the image source to be these variables would that get round the problem of having the mysql inside the code for the message variable.

would the code for this be something like

  1. $image1 = <?php
  2.  
  3. $query = "SELECT broad1 FROM images_broad";
  4. $result=mysql_query($query);
  5.  
  6. while($row=mysql_fetch_array($result, MYSQL_ASSOC)){
  7. echo '<img src="'.$row['broad1'].'"/>';
  8. }
  9.  
  10. ?>

and then use the $image1
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 347
Reputation: kevin wood is an unknown quantity at this point 
Solved Threads: 1
kevin wood's Avatar
kevin wood kevin wood is offline Offline
Posting Whiz

Re: php mailto () fuction

 
0
  #6
Apr 4th, 2008
instead of having the echo at the bottom of the mysql query should i try to set the result from the query to a variable and then recall this variable in the image tag.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,678
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 319
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: php mailto () fuction

 
0
  #7
Apr 4th, 2008
Instead, assign it to $message.
$message.="<img src=$row['broad1']>";
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 347
Reputation: kevin wood is an unknown quantity at this point 
Solved Threads: 1
kevin wood's Avatar
kevin wood kevin wood is offline Offline
Posting Whiz

Re: php mailto () fuction

 
0
  #8
Apr 4th, 2008
the code i have got for the database connection looks like this and it is placed before the body tag in the php page so that it has no effect on what it being displayed on the page

  1. $query = "SELECT broad1 FROM images_broad";
  2. $result=mysql_query($query);
  3.  
  4. while($row=mysql_fetch_array($result, MYSQL_ASSOC)){
  5. $message.= '<img src="'.$row['broad1'].'"/>';


when the variable l $message has been set to equal the image from the database would it be displayed in the image tag in the body of the message like this

  1. <img src=\"$message\" />
  2.  
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,678
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 319
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: php mailto () fuction

 
0
  #9
Apr 4th, 2008
I didn't get you.. What I said was,
concat <img src='row1['broad1']> to $message. So, it will be like,
$message.=$row1['broad1'];
then again,
  1. $message.=<p>&nbsp;</p></div></th>
  2. <td width=\"77%\" scope=\"col\"><table width=\"99%\" border=\"0\" cellpadding=\"10\" cellspacing=\"0\">
  3. <tr> //.... and so on
  4.  
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 347
Reputation: kevin wood is an unknown quantity at this point 
Solved Threads: 1
kevin wood's Avatar
kevin wood kevin wood is offline Offline
Posting Whiz

Re: php mailto () fuction

 
0
  #10
Apr 4th, 2008
instead of putting the code in for the message is there not a way to just recall the page which already has the images inserted into it from the database. the page is created when the user goes to the preview page.

i was trying to work this out using an i frame but when it went to the page where it tells the user the message was sent it was displaying the preview page over the top of that page and the email was blank.

if that could be done it would save duplicating the code to produce the same page twice and if it can be done it would save the hassle of trying to insert images into the code for the message as it clearly does not want mysql code in that section of the code.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC