<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
You're overwriting the $user variable since this script is running in
the global namespace:<br>
<br>
<br>
$user= $_GET['u'];<br>
<br>
$user is populated with the user object on bootstrap and now you're
changing it. That's your problem. To prevent conflicts I would wrap
everything below:<br>
<br>
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);<br>
<br>
into a function and just call that.<br>
<pre class="moz-signature" cols="72">Jamie Holly
<a class="moz-txt-link-freetext" href="http://www.intoxination.net">http://www.intoxination.net</a>
<a class="moz-txt-link-freetext" href="http://www.hollyit.net">http://www.hollyit.net</a></pre>
<br>
On 2/13/2010 10:52 AM, Dayton Perkins wrote:
<blockquote cite="mid:4B76CAA9.5060109@chartermi.net" type="cite">I am
using Mime Mail to send mails to users who are opted in to a users
mailing list for a certain user role. I had written a similar script
for another site, looping through email addresses and invoking
mimemail() for each. Unfortunately though I pumped up the memory limit,
that script white screened ( haven't checked in too much detail as the
"client" is a non-payer), though the script did send out the mails.<br>
<br>
So for this project, I decided to class it up a bit using jQuery to
loop through sending $get requests to the server and load in a
"loading" graphic whilst waiting for a response for each mail in turn.
I put my mailing script in the docroot since putting it in my module
resulted in path errors. Everything works, including sending the
emails, loading in the loading graphic per email and then a sent
message, writing to the database, etc. EXCEPT for 2 things.<br>
When I open the script in a browser, I get the following notices:<br>
<br>
<b>Notice</b>: Trying to get property of non-object in <b>/home/content/t/o/n/tonebari/html/modules/dblog/dblog.module</b>
on line <b>135</b><br>
<b>Notice</b>: Trying to get property of non-object in <b>/home/content/t/o/n/tonebari/html/includes/database.mysqli.inc</b>
on line <b>102</b><br>
<b>Notice</b>: Trying to get property of non-object in <b>/home/content/t/o/n/tonebari/html/modules/dblog/dblog.module</b>
on line <b>135</b><br>
<b>Notice</b>: Trying to get property of non-object in <b>/home/content/t/o/n/tonebari/html/includes/database.mysqli.inc</b>
on line <b>102</b><br>
<b>Notice</b>: Trying to get property of non-object in <b>/home/content/t/o/n/tonebari/html/modules/dblog/dblog.module</b>
on line <b>135</b><br>
<b>Notice</b>: Trying to get property of non-object in <b>/home/content/t/o/n/tonebari/html/includes/database.mysqli.inc</b>
on line <b>102</b><br>
<b>Notice</b>: Trying to get property of non-object in <b>/home/content/t/o/n/tonebari/html/modules/dblog/dblog.module</b>
on line <b>135</b><br>
<b>Notice</b>: Trying to get property of non-object in <b>/home/content/t/o/n/tonebari/html/includes/database.mysqli.inc</b>
on line <b>102<br>
<br>
<br>
Additionally, </b>when I run the AJAX page, it sends the emails,
writes the data and everything looks dandy, but when I navigate to
another page I find I have been logged out! :-) I do see the first
notice above is inside dblog_watchdog() Seems to me that the browser
isn't sending cookies? I added global $user; print_r($user); right
after the call to drupal_bootstrap, (after re-logging ;-) )and I see
that I my user data is present.<br>
help? <b><br>
<br>
</b>here's the mailer script<br>
<?php<br>
error_reporting(E_ALL);<br>
require_once './includes/bootstrap.inc';<br>
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);<br>
$sender = '<a moz-do-not-send="true" class="moz-txt-link-abbreviated"
href="mailto:no-reply@example.com">no-reply@example.com</a>';<br>
$last = $_GET['l'];<br>
$cid = $_GET['c'];<br>
$user= $_GET['u'];<br>
if($user==0){ // not a user || no uid ;These emails are added to the
database another way...<br>
$recipient = $_GET['e'];<br>
$mail = $recipient;<br>
} else {<br>
$recipient = get_user($user); // This gets the user object I also
tried just using global $user and $user->mail<br>
$mail = $recipient->mail;<br>
}<br>
if(!isset($_SESSION['mailer-errors'])) { $_SESSION['mailer-errors']=0; }<br>
$subject = $_SESSION['subject'];<br>
$code=randStrng();<br>
$optLink = '<p>'.l('Opt out of these emails',
'<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://example.com/center/opt">http://example.com/center/opt</a>',
array('query' =>
'cid='.$cid.'&code='.$code.'&mail='.$mail)).'</p>';<br>
$body = $_SESSION['body'].$optLink;<br>
if($sent = mimemail($sender, $recipient, $subject, $body)) {<br>
write_promo_data($user, $recipient, $cid, $code);<br>
echo 1;<br>
} else {<br>
echo 0;<br>
$_SESSION['mailer-errors'] ++;<br>
}<br>
if($last ==1) {<br>
if($_SESSION['mailer-errors']==0) {<br>
unset($_SESSION['send']);<br>
unset($_SESSION['subject']);<br>
unset($_SESSION['body']);<br>
unset($_SESSION['created']);<br>
}<br>
unset($_SESSION['mailer-errors']);<br>
}<br>
<div class="moz-signature">-- <br>
<em>Kindest regards,</em> <b>Dayton Perkins</b>
<div
style="font-family: "Comic Sans MS"; text-align: center; display: block;"><span
style="color: rgb(0, 153, 0); font-size: 1em; font-weight: bold;">Good
News Design</span><br>
<span style="font-size: 0.85em;">
<span style="color: rgb(0, 0, 153); font-weight: bold;">Intelligent
Web
Programming for Business</span><br>
3611 Butternut Drive, Suite 40<br>
Holland MI 49424<br>
616-399-5617<br>
</span>
<a moz-do-not-send="true" href="http://goodnewsdesign.com"
style="text-decoration: none;" onmouseover="this.style.color='#006600'"
onmouseout="this.style.color='#CCCCCC'" title="Visit">http://goodnewsdesign.com<br>
<img moz-do-not-send="false" style="border: 0pt none ;"
src="cid:part1.07090207.05000601@earthlink.net" alt="Signature"></a><a
moz-do-not-send="true" href="http://goodnewsdesign.com"
style="text-decoration: none;" onmouseover="this.style.color='#006600'"
onmouseout="this.style.color='#CCCCCC'" title="Visit">
</a></div>
</div>
</blockquote>
</body>
</html>