I was thinking about a news component

James Murphy Posted in Component Development 6 years ago

For special announcements, srolling text coming in from the left on the top bar, with a choice of text colours. An alternative would be a bulk messager. both cool. Don't mind paying. thank you.

Replies
us Rishi B Replied 6 years ago

James, if you want some custom development done for this issue (or others related to OSSN), feel free to contact me at rishibhat[at]gmail. I wouldn't call myself an expert on OSSN, but I've done quite a bit of customization that's worked well for me (which includes component development). Take care.

pk Malik Umer Farooq Replied 6 years ago

I will try my best after some time

Afrikaans James Murphy Replied 6 years ago

Just a big thank you, not sure I can implement so will go for an external bulk mail program.
Maybe you guys can implement the code so that it becomes a simple matter to adapt to any mail server.
A huge thanks.

us Rishi B Replied 6 years ago

James, if you're new to component development and just want a quick tool to email all your users, you could just write an external script (in any language) that connects to your mysql server and grabs the email addresses from the ossn_users table, and sends a message (using either smtp or sendmail). PHPMailer at https://github.com/PHPMailer/PHPMailer provides a simple php interface and I believe the OSSN component for SMTP also uses it. Here's some quick sample code. Also, smtp2go.com provides free (though limited) smtp service. You can also use GMail's free smtp relay if you have a gmail account. PHPMailer includes sample code for the values to use for gmail.

require_once("phpmailer/PHPMailerAutoload.php");
require_once("phpmailer/class.phpmailer.php"); // include the PHPMailer class

$dbhost = "localhost";
$dbuser = "root"
$dbpass=""; // fill in your mysql server info
$dbname = "ossn";

$returnEmail = "[email protected]";
$returnName = "Your name";
$destSubj = "subject"; 
$destBody = "enter text body of email here"; // fill in these values

$link = mysql_connect($dbhost, $dbuser, $dbpass) or die('Error connecting to mysql');
mysql_select_db($dbname);

$sql = "SELECT email FROM ossn_users WHERE 1"; 
// this gets all users, if you want to get only active users or some other subset 
// you can modify the query
$result = mysql_query($sql,$link);
while ($row = mysql_fetch_array($result))
{

$mail = new PHPMailer(); 
$mail->SMTPDebug = 0;
$mail->IsSMTP(); // send via SMTP

$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->SMTPSecure = 'none'; // secure transfer enabled REQUIRED for GMail

$mail->Host = "mail.smtp2go.com";
$mail->Port = 2525;  // replace with your smtp server

$mail->Username = ""; 
$mail->Password = ""; // set your smtp server username/password here

$email=$row[0]; // Recipients email ID
$name="ossn user"; // Recipient's name
$mail->From = $returnEmail;
$mail->FromName = $returnName;
$mail->AddAddress($email,$name);
$mail->AddReplyTo($returnEmail,$returnName); // reply-to field is optional

$mail->AddBCC("[email protected]","r"); // add a BCC address if you want
$mail->WordWrap = 0; // set word wrap. 0 = off, 78 = standard value used in html encoding.
//$mail->AddAttachment("/var/tmp/file.tar.gz"); // attachment
//$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // attachment
$mail->IsHTML(false); // send as HTML or plaintext
$mail->Subject = $destSubj; //"This is the subject";
$mail->Body = $destBody; 
$mailstatus = "";
echo "Trying to send...";
if(!@$mail->Send())
{
     //echo "Mailer Error: " . $mail->ErrorInfo;
     $mailstatus = "Mailer Error: " . $mail->ErrorInfo;
}
else
{
    $mailstatus = "Message has been sent";
}
echo $mailstatus;

}
pk Malik Umer Farooq Replied 6 years ago

Sorry to say you are still unsure
so lets learn how we implement sms system

What is API in bulk SMS?

According to **https://www.bulksms.com** SMS Gateway API. Our most popular API is the HTTP to SMS API. The EAPI (HTTP to SMS API) is a RESTful API that uses simple query parameters via URLs. If you can put together a Web page with a form, backed by a scripting language (e.g. PHP), you already have what you need to send SMSs.

take a look at
https://gist.github.com/wayneashleyberry/4058663

sorry to say i unable to help you as my exam are near

maybe core team help you

for simple just edit the mailer component find php bulk sms class and use that
thanks

Afrikaans James Murphy Replied 6 years ago

Anything that works, maybe I could use my own mail server. I have no idea how and where to code this in. An example would help and maybe I can figure out how to change the bits that need changing to my web server. thanks

Afrikaans James Murphy Replied 6 years ago

Malik, I would need help on that. can you provide an example code, where to place it and maybe I can change bits to my website smtp.
thank you

pk Malik Umer Farooq Replied 6 years ago

The mailer component is work perfectly everybody knows that.
For Bulk SMS you need purchase / or use free api
you can easily use this component to make bulk sms component by clanging some code

Afrikaans James Murphy Replied 6 years ago

Malik, how do I install api, anything that works. This would be good if you explain how to do this, to make the mailer work. A huge thanks.

pk Malik Umer Farooq Replied 6 years ago

For now you able send mail to users take a look
https://www.opensource-socialnetwork.org/component/view/2789/malik-mailer