Smart Mailer PHP Support Product Page

Solved

Warning: session_start()

Reported 12 Jun 2012 22:36:06
2
have this problem
12 Jun 2012 22:36:06 Rusty Monette posted:
I have put the smart mailer on a php page with nothing on and I am getting this error:

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by


<?php error_reporting(E_ALL);
ini_set('display_errors', true);  ?>
<?php require_once('ScriptLibrary/incSmartMailer.php'); ?>
<?php
$sm1 = new SmartMailer();
$sm1->checkVersion("1.08");
$sm1->smtpSetup("mail.someaddress.com", 25, "info@someaddress.com", "passwordhere");
$sm1->component = "SMTP";
$sm1->tmpFolder = "";
$sm1->embedImages = false;
$sm1->progressBar = "";
$sm1->ignore_errors = true;
@set_time_limit(300);
$sm1->setFrom("Customer", "email@someaddress.com");
$sm1->setTo("CustomerMainEmail", "email@someaddress.com");
$sm1->setCc("", "");
$sm1->setBcc("Back Up Email", "email@someaddress.com");
$sm1->setSubject("Contact Form");
// using template for body
$sm1->setBody_Template_html("EmailTemplate.php");
// Attachments none
$sm1->sendMail("one");
$GoTo = "ThankYou.php";
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$GoTo .= (strpos($GoTo, '?')) ? "&" : "?";
$GoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
header (sprintf("Location: %s", $GoTo));
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>

<body>
</body>
</html>

Replies

Replied 17 Jun 2012 13:22:29
17 Jun 2012 13:22:29 Rusty Monette replied:
Just wonder if there has been any status on this error. I have tried using this on a new Windows server with settings of:

PHP 4.4.9
PHP 5.2.17

Just really need a solution to this issue. The mail system is of no use if it doesn't send email. Thank you.
Replied 24 Jun 2012 17:14:37
24 Jun 2012 17:14:37 Bernd Schmitt replied:
I had this issue with the form validator. The function generate_javascript_and_css() is inner the head of the html code and use the function get_javascript(). A session must be initialized befor a html header is sended. One empty line out of the <?php ... ?> tag in the source code already sends a html header.

Try to commend out the line 7 in incSmartmailer.php ( // session_start() and set the session_start() command on the top of the source code or change the line to
if(!session_id()) session_start();
Replied 18 Dec 2012 01:56:22
18 Dec 2012 01:56:22 Steve Skinner replied:
I know this is WAY late in response to this problem, but I thought it would be good to document it for future reference.

You have to turn off unicode signature (BOM) for the page. From the property inspector, after opening the page in DW, click "page properties" and then click "Title/Encoding" on the left and UNCHECK the option to Include Unicode Signature (BOM). I did vast research on this problem before finally stumbling across this helpful tidbit that solved this problem for me.

Reply to this topic