close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Sending Emails Using a Recordset

Thread began 11/07/2018 8:55 am by Ivica | Last modified 11/13/2018 12:47 pm by Ray Borduin | 30 views | 8 replies |

Ivica

Sending Emails Using a Recordset

I have a table in the database with 4 email addresses. I want to send email to these addresses.
It's only sending email to the first record - it's not looping through the recordset and sending an email to each email address.
my code:
if (isset($_POST["button"]) || isset($_POST["button_x"])) { //WA Universal Email
$Email = new WA_Email("mail_2");
$Email->Redirect = "mail.php";
$Email->From = "info@cccccc.com";
$Email->BurstSize = "5";
$Email->BurstTime = "1";
$Email->addToFromRS("email","emailaddress");
$Email->BodyFile = "webassist/email/templates/WebAssist-Block/Block_5.php";
if (function_exists("rel2abs") && $Email->Redirect) $Email->Redirect = $Email->Redirect?rel2abs($Email->Redirect,dirname(__FILE__)):"";
for ($emailGroup=0; $emailGroup<sizeof($Email->To); $emailGroup++) {
$Email->Subject = "";
$Email->send($emailGroup);
}
$Email->close();
}

Sign in to reply to this post

Ray BorduinWebAssist

In your recorset code, update the recordset object where it says ",1" and change it to ",0".

That is where it sets the number of records to be returned by the recordset. Zero returns all records.

Sign in to reply to this post

Ivica

Dear Ray,
Here is recordset code:
<?php
$email = new WA_MySQLi_RS("email",$konn,0);
$email->setQuery("SELECT * FROM newsletter ORDER BY emailid ASC");
$email->execute();
?>
Where to change 1 to 0
I sent you PM

Sign in to reply to this post

Ray BorduinWebAssist

I added myself to the BCC and it sent to all the recipients. Maybe it is getting spam blocked so you aren't seeing the emails? I added an email subject. Some email servers are more likely to block emails without a subject.

Sign in to reply to this post

Ivica

Thanks, Ray,
I do not know what happened. I checked the spam folder.
Thanks again

Sign in to reply to this post

Ray BorduinWebAssist

I can definitely see they are all sending. Did you get them once I added the subject, or are they still not showing?

Sign in to reply to this post

Ivica

Everything is OK now

Sign in to reply to this post

Ray BorduinWebAssist

Please remove the BCC line I added... I'm getting your emails ;)

Sign in to reply to this post

Ivica

sorry :(

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...