this is a follow-up thread to this one. http://bytes.com/topic/html-css/answ...tted-sometimes
I figured out that the mail sending class triggers the described error. unfortunately, no error message is given by the system. - <?php
-
class Mail_Tabelle extends Mail_DB
-
{
-
protected $description = false;
-
const TBL_HEAD = '
-
<thead>
-
<tr>
-
<th id="spalte1">Datum</th>
-
<th id="spalte2">Nachricht</th>
-
</tr>
-
</thead>';
-
-
function __construct()
-
{
-
parent::load();
-
-
if (isset($_POST['senden']))
-
{
-
$this->sendMail();
-
}
-
if (isset($_GET['desc']) and preg_match('#^\d+$#', $_GET['desc']) == 1)
-
{
-
$this->description = (int) $_GET['desc'];
-
}
-
}
-
-
public function printTable()
-
{
-
$anzahl = count(parent::$DB_mails);
-
if ($anzahl == 0) return false;
-
echo '
-
<table id="blog">', self::TBL_HEAD, '
-
<tbody>';
-
for ($i=0; $i<$anzahl; ++$i)
-
{
-
$desc = ($this->description === $i) ? true : $i;
-
parent::$DB_mails[$i]->printTableRow($desc);
-
}
-
echo '
-
</tbody>
-
</table>
-
';
-
}
-
-
protected function sendMail()
-
{
-
$text = $_POST["NLG"];
-
$betreff = $_POST["betreff"];
-
if (!$text or !$betreff) return false;
-
$adr = $this->prepareMail();
-
$msg = "[...]";
-
$RS = new Mail_Verteiler($msg, $betreff); // problem is HERE
-
$RS->setList($adr);
-
$RS->sendMails();
-
$this->saveMail();
-
}
-
}
-
?>
I suspect something with the loading isn't going right, because it doesn't matter if I uncomment the parent constructor (line 11) or not.
can anyone give me an idea how to get some clues where the problem's cause is? - <?php
-
require_once LIB_DIR . "Swift/Plugin/Decorator.php";
-
-
class Mail_Verteiler extends KBL_Mail
-
{
-
protected $to = NULL;
-
protected $replace = array();
-
-
function __construct($msg, $subj)
-
{
-
parent::__construct($msg, $subj);
-
}
-
-
public function setList($empfanger)
-
{
-
if (!is_array($empfanger)) return false;
-
if (!($this->to instanceof Swift_RecipientList))
-
{
-
$this->to = new Swift_RecipientList;
-
}
-
foreach ($empfanger as $person)
-
{
-
$Name = ($person['Name']) ? $person['Name'] : 'Leser';
-
$this->to->addTo($person['Email']);
-
$this->replace[] = array('{name}' => $Name, '{UID}' => $person['UID']);
-
}
-
return true;
-
}
-
-
public function sendMails($from = 'email@host.tld')
-
{
-
if (!($this->to instanceof Swift_RecipientList))
-
{
-
$this->sent = false;
-
return false;
-
}
-
$this->mail->attachPlugin(new Swift_Plugin_Decorator($this->replace), "decorator");
-
return $this->sendTo($this->to, $from);
-
}
-
}
-
?>
- <?php
-
require_once LIB_DIR . "Swift.php";
-
require_once LIB_DIR . "Swift/Connection/SMTP.php";
-
require_once CONF_DIR . "conf.mail.php";
-
-
/**
-
* a little wrapper around Swift_Mail for sending error reports.
-
* only basic email sending is intended, so for HTML form results
-
* use Swift directly.
-
*/
-
class KBL_Mail
-
{
-
/**
-
* @var (object) $mail Swift Mail (root) class
-
* @var (bool) $sent success of sending the email
-
* @var (string) $subject email subject
-
* @var (string) $message email message
-
*/
-
protected $mail = NULL;
-
protected $sent = false;
-
public $subject;
-
public $message;
-
-
/**
-
* establish the connection to the SMTP server
-
* load subject & message
-
*/
-
function __construct($message = '', $subject = 'Fehlerbericht')
-
{
-
# connect to the mail server
-
$smtp = new Swift_Connection_SMTP(KBL_MAIL_SMTP_STD, 587, Swift_Connection_SMTP::ENC_OFF);
-
$smtp->setUsername(KBL_MAIL_USER);
-
$smtp->setPassword(KBL_MAIL_PASS);
-
-
# create swiftmailer class
-
$this->mail = new Swift($smtp);
-
$this->subject = $subject;
-
$this->message = $message;
-
}
-
-
function __destruct()
-
{
-
$this->mail->disconnect();
-
}
-
-
/**
-
* send email
-
*
-
* @param (string) $to recipient (To:)
-
* @param (string) $from sender (From:)
-
* @return (void)
-
*/
-
public function sendTo($to = KBL_MAILTO_ADMIN, $from = 'email@host.tld')
-
{
-
$swift_msg = new Swift_Message($this->subject, $this->message);
-
$swift_msg->headers->setLanguage("de");
-
$this->sent = $this->mail->send($swift_msg, $to, $from);
-
return $this->sent;
-
}
-
}
-
?>
0 1529 Sign in to post your reply or Sign up for a free account.
Similar topics
by: dmcconkey |
last post by:
Hi folks,
I have a client with four websites. Each site has a contact form that
is identical. They all have "required" fields validated through a
JavaScript onSubmit() function. Upon validation,...
|
by: Manuel Lopez |
last post by:
I have a puzzling form timer problem that I didn't experience prior to
Access 2003 (though I'm not sure access 2003 is to blame).
Here's the situation: a computer has two access 2003 databases on...
|
by: Scott |
last post by:
How can I tell a form to submit itself in the code-behind
in vs.net?
In other words, in javascript I can do blah.submit() - how
do I do this in vs.net code-behind?
|
by: Ger |
last post by:
My dialogue form (sometimes partly, sometimes as a whole) remains visible
during a fairly long processing job.
The dialogue asks the user to enter some data for the job to follow, and
after OK,...
|
by: gerryLowry::Ability Business Computer Services {KC |
last post by:
"Getting Back Your Visual Basic 6.0 Goodies" by Billy Hollis, 2003-5-14,
states:
"Getting a Forms Collection
Visual Basic 6.0 developers are often fond of looping through the currently
loaded...
|
by: Jack |
last post by:
Hi,
I have a asp form where one element is a list box which lists four years
starting from 2004. This list is drawn from a database table which has YearID
and Year as two fields as shown below:...
|
by: deko |
last post by:
I have a basic feedback form with a submit button.
After the "send" button is clicked, I want the user to be redirected to a
different page that says "Your message has been sent."
How do I do...
|
by: AJang |
last post by:
My windows form "Form1" has one Button "button1" and one TextBox "textBox1".
When I click button1, it do a job for each file in a directory. The job
include some platform invoke call. Before...
|
by: Greg Scharlemann |
last post by:
I'm trying to setup a dyamic dropdown list that displays a number of
text fields based on the selected number in the dropdown. The problem
I am running into is capturing the data already entered...
|
by: Zytan |
last post by:
I have public methods in a form. The main form calls them, to update
that form's display. This form is like a real-time view of data that
is changing.
But, the form may not exist (it is...
|
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...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
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...
|
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...
|
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)...
|
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...
|
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
|
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...
| |