Click here to download VisualGSM SMS Gateway



sms software
About UsHow to buyDownloadSitemapContact Us
 
Our ProductsServicesNews & EventsOnline DemoCustomer SupportClient/UsersPartner Program


  Reply to this topicStart new topicStart Poll

> SMS-to-Email To Multiple Recepients, Send Email From SMS to Multiple Recepien
sdfungayi
Posted: Feb 5 2010, 08:03 AM
Quote Post


Advanced Member
***

Group: Members
Posts: 52
Member No.: 1011
Joined: 18-December 07



I want to forward contents of an SMS to mobile phone numbers or email addresses of receipients listed in my database depending on the parameters in the body of the incoming SMS

For example, the following incoming SMS:
CONTACT singapore software developers mobile. send me your product list

will forward the body of the SMS via email, text message or both to mobile communication software developers in Singapore who are listed in our database

I tried the the SMS-to-Email function of the VisualGSM but was only able to forward to receipents only listed in the SMS. I could not incorporate search parameters in the function to choose email addresses or mobile numbers of recepients

I am using MySQL 5
PMEmail Poster
Top
admin
Posted: Feb 8 2010, 06:06 AM
Quote Post


Administrator
***

Group: Admin
Posts: 1074
Member No.: 1
Joined: 5-May 03



The SMS-to-Email function only sends to one email address. To send to multiple, you will need to use a script such as PHP - http://www.visualgsm.com/tutorial011_send_sms_php.htm


--------------------
VisualGSM SMS Gateway.
VisualGSM SMS Server Downloads.
PMEmail Poster
Top
sdfungayi
Posted: Feb 8 2010, 06:54 AM
Quote Post


Advanced Member
***

Group: Members
Posts: 52
Member No.: 1011
Joined: 18-December 07



Apparently all the examples refer to sending SMS not email.
I need to know how to send email by selecting email addresses from a table.

I have broken down what I want to do into the three steps below. My challenge is Step 3 where I need help.

Step 1. Receive SMS
Step 2. Select email_addresses and phone_numbers from TABLE where criteria matches SMS parameters
Step 3. Send SMS contents via email to all email_addresses and phone_numbers selected in Step 2

I want to use FUL-TEXT SEARCH
PMEmail Poster
Top
admin
Posted: Feb 10 2010, 05:13 AM
Quote Post


Administrator
***

Group: Admin
Posts: 1074
Member No.: 1
Joined: 5-May 03



QUOTE (sdfungayi @ Feb 8 2010, 06:54 AM)
Apparently all the examples refer to sending SMS not email.
I need to know how to send email by selecting email addresses from a table.

I have broken down what I want to do into the three steps below. My challenge is Step 3 where I need help.

Step 1. Receive SMS
Step 2. Select email_addresses and phone_numbers from TABLE where criteria matches SMS parameters
Step 3. Send SMS contents via email to all email_addresses and phone_numbers selected in Step 2

I want to use FUL-TEXT SEARCH
CODE
require_once('./public/class.phpmailer.php');  
 $mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch
 $mail->IsSMTP(); // telling the class to use SMTP
  try {

 $mail->SMTPDebug  = 1;                     // enables SMTP debug information (for testing)
 $mail->SMTPAuth   = true;                  // enable SMTP authentication
 $mail->SMTPSecure = "ssl";                 // sets the prefix to the servier
 $mail->Host       = "smtp.gmail.com";      // sets GMAIL as the SMTP server
 $mail->Port       = 465;                   // set the SMTP port for the GMAIL server
 $mail->Username   = "gmail-email-address";  // GMAIL username
 $mail->Password   = "gmail-password";            // GMAIL password    */
 $mail->AddReplyTo($YourEmailAddress,$YourEmailAddress);
 $mail->AddAddress($RecipientEmailAddress,$RecipientEmailAddress);
 $mail->SetFrom($YourEmailAddress,$YourEmailAddress);
 $mail->Subject = $subject;
 $mail->Body = $body;
 $mail->Send();
  print "email sent!";

} catch (phpmailerException $e) {
 echo $e->errorMessage(); //Pretty error messages from PHPMailer
 sleep(10);
 $mail->Send();
} catch (Exception $e) {
 echo "Error encountered when sending password email. Please contact your administrator for further assistance.";
 echo $e->getMessage(); //Boring error messages from anything else!
}


--------------------
VisualGSM SMS Gateway.
VisualGSM SMS Server Downloads.
PMEmail Poster
Top
sdfungayi
Posted: Feb 13 2010, 01:50 PM
Quote Post


Advanced Member
***

Group: Members
Posts: 52
Member No.: 1011
Joined: 18-December 07



I adapted the script you suggested. When I run it it sends multiples copies of the same to each recepient. For example, if there are ten (10) emails address in the table, the first email address in the table receives 10 emails, the second gets 9, and the last gets 1.
How do I solve this?
Please see the script below.

<?php
require_once("class.phpmailer.php");

$mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch

$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "smtp.mailprovider"; // SMTP server

$mail->From ="address@email.com";
$mail->FromName = "Lions";

@MYSQL_CONNECT("localhost","root","");
@mysql_select_db("vgsmdb");
$query = "SELECT * FROM studentsemails";
$result = @MYSQL_QUERY($query) or die(mysql_error());
while ($row = mysql_fetch_array ($result)) {
$mail->AddBCC($row["Email"]);


$mail->Subject = "Test Email Message";
$mail->Body = "Test: This is my first email sent through";

if(!$mail->Send()) {
echo 'Message was not sent.';
echo 'Mailer error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent.';
}
}
?>
PMEmail Poster
Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

Topic Options Reply to this topicStart new topicStart Poll

 



[ Script Execution time: 0.0541 ]   [ 11 queries used ]   [ GZIP Disabled ]