473,326 Members | 2,192 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

$this->header .= $this->body; Won't send the email

I've just acquired a site and uploaded to godaddy and the email function won't work. I'm new to php and I'm not able to determine where the issue is. I've commented out $this->header .= $this->body; and I get a blank email to send. I've stripped down the body file but there still seems to be a problem. I'm not sure where to look now. This is the body file.

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. /******************** EMAIL ***************************/
  3.  
  4. $sRuta = "domain";
  5.  
  6. function darTemplateCancelacionDeClaseParaProfesores($aDatos){
  7. global $sRuta;
  8.  
  9. $sTemplate = "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>
  10. <html>
  11. <head>
  12. <title>Document</title>
  13. <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>
  14. <link href='".$sRuta."/estilos.css' rel='stylesheet' type='text/css'>
  15.  
  16. </head>
  17.  
  18. <body>
  19. <p>                          We would like to inform you that one of your classes 
  20.                           was cancelled.</p>
  21.  
  22. </body>
  23. </html>
  24. ";
  25.  
  26. return $sTemplate;
  27. }
  28.  
  29. function darTemplateCancelacionDeClaseParaAlumnos($aDatos){
  30. global $sRuta;
  31.  
  32. $sTemplate = "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>
  33. <html>
  34. <head>
  35. <title>Document</title>
  36. <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>
  37. <link href='".$sRuta."/estilos.css' rel='stylesheet' type='text/css'>
  38.  
  39. </head>
  40.  
  41. <body>
  42. <p>                          We would like to inform you that one of your classes 
  43.                           was cancelled.</p>
  44.   </body>
  45. </html>
  46. ";
  47.  
  48. return($sTemplate);
  49.  
  50. }
  51.  
  52.  
  53. include("class_mail.php"); 
  54.  
  55. function enviarEmail($sTipoMail , $sAsunto, $sEmail, $aDatos, $sBccEmail=''){
  56.  
  57.     switch ($sTipoMail) {
  58.         case 'bienvenida_alumno':
  59.             $sTemplate = darTemplateBienvenidaAlumno($aDatos);
  60.         break;
  61.  
  62.         case 'bienvenida_profesor':
  63.             $sTemplate = darTemplateBienvenidaProfesor($aDatos);
  64.         break;
  65.  
  66.         case 'solicitudClase':
  67.             $sTemplate = darTemplateSolicitudClase($aDatos);
  68.         break;
  69.  
  70.         //Cuando el alumno cancela la clase.        
  71.         case 'cancelClassPorAlumno':
  72.             $sTemplate = darTemplateCancelacionDeClaseParaProfesores($aDatos);
  73.         break;
  74.  
  75.         //Cuando el profesor cancela la clase.        
  76.         case 'cancelClassPorProfe':
  77.             $sTemplate = darTemplateCancelacionDeClaseParaAlumnos($aDatos);
  78.         break;
  79.  
  80.  
  81.         //Cuando el profesor  acepta una invitacion de clase
  82.         case 'clase_invitacion_confirmada':
  83.             $sTemplate = darTemplateInvitacionConfirmada($aDatos);
  84.         break;
  85.  
  86.         //Cuando el profesor rechaza una invitacion de clase
  87.         case 'clase_invitacion_cancelada':
  88.             $sTemplate = darTemplateInvitacionCancelada($aDatos);
  89.         break;
  90.  
  91.  
  92.         case 'resendRequest':
  93.             $sTemplate = darTemplateResendRequest($aDatos);
  94.         break;        
  95.     }
  96.  
  97.     $cabeceras = "From: support\nContent-type: text/html\n"; //change email & remove r ap23
  98.  
  99.  
  100.     //mail($sEmail, $sAsunto, $sTemplate, $cabeceras);
  101.  
  102. $html = true; 
  103.  
  104. // Absender angeben 
  105. $mail = new eMail("from","email"); 
  106.  
  107. // Betreff angeben 
  108. $mail->subject($sAsunto); 
  109.  
  110. // Entfänger angeben 
  111.  
  112. $mail->to($sEmail);
  113. $mail->bcc($sBccEmail);
  114. //$mail->to("somebody@domain.net"); 
  115.  
  116. // CC-Entfänger angeben 
  117.     //$mail->cc("somebody@domain.net"); 
  118.     //$mail->cc("somebody@domain.net"); 
  119.  
  120. // BCC-Entfänger angeben 
  121.     //$mail->bcc("somebody@domain.net"); 
  122.     //$mail->bcc("somebody@domain.net"); 
  123.  
  124. if(true==$html) 
  125.     // HTML angeben 
  126.     $mail->html($sTemplate); 
  127. else 
  128.     // Text angeben 
  129.     $mail->text("My first Text-Mail"); 
  130.  
  131. // Anhang hinzufügen 
  132. //$mail->attachment("text.zip"); 
  133.  
  134. // eMail versenden 
  135. $mail->send(); 
  136. }
  137. ?>
And these are the headers

Expand|Select|Wrap|Line Numbers
  1.  
  2. $this->header .= "Content-Type: multipart/mixed; boundary=$this->boundary\n\n";
  3.         $this->header .= "This is a multi-part message in MIME format\n";
  4.         $this->header .= "--$this->boundary\n";
  5.         $this->header .= $this->body;
  6.         $this->header .= "MIME-Version: 1.0\n";
  7.  
Apr 29 '09 #1
2 1788
Amzul
130 100+
do you receive any kind of mail??

maybe the mail server is not configure in the server.
ask your host support
Apr 30 '09 #2
Yes the mail server works. If I take out the $this->header from the mail function and input text it sends it just fine. It seems to be a problem with the file that contains all the replies. I'm not sure what could be causing the hang up.
May 1 '09 #3

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

Similar topics

1
by: sfgroups | last post by:
How will I do this in perl? print 1 line of context before and after regexp, with line number # indicating where the regexp occurred (similar to "grep -A1 -B1") sed -n -e...
3
by: kmoon | last post by:
Any help on this would be gretly appreciated. Take a look at this page http://www.patrioticpriorities.org/test/cl/ and tell me why the yellow header and red nav bar will not extent all the way to...
9
by: bkfake-google | last post by:
Seems simple enough yet I can't seem to accomplish it in CSS. I want a header area in where the height can vary.. Below that I want an area that fills the remaining area. What's the trick?...
0
by: Gerald Thallinger | last post by:
Hallo together! I try so solve the following problem. I wrote a HTML-File an print it via MS Internet Explorer, Version 6.0. I currently have all 3 tables in my report for outputting. I...
2
by: Tim T | last post by:
Hi, I'm new to .NET and am still trying to get my head around OO concepts. I am building an asp.net app and on several pages i want to check to see if a session object exists, if so - contine to...
2
by: Chris Saunders | last post by:
I'm just beginning to learn ADO.NET and have taken some code from the book "Pro ADO.NET 2.0". When I run this application the "Validated" MessageBox gets displayed but when I quit and rerun the...
5
by: jmprince01 | last post by:
***instructions: write a function sreplace( ) with the prototype: void sreplace(char newc, char oldc, char *s); which will replace all occurances of the character oldc with the character newc in...
2
by: memiller | last post by:
I have a hyperlink on an ASP page that calls another ASP page with the code shown below. This page allows (forces) a user to select a file to be uploaded, then should call a third ASP page that...
20
by: Pete Marsh | last post by:
Wondering if anyone can see an error with this script. I get a server configuration error. THat could mean a module is not being loaded, but maybe there's a syntax error here, can anyone spot it?...
3
by: Wayne | last post by:
I have several sub-reports in the footer of a main report. In certain situations when one of the sub-reports is pushed down to near the bottom of the page by the sub-reports above it, the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.