How to send SMS on osclass user registration - osclass

I am a beginner.
I want to send a welcome SMS to a new user in osclass, adding the SMS API on each page.
If anybody knows where is the "Registration email send" I can integrate it there.
I have tried in utils.php but it's not working.
My Script is:
////SMS Start
$name = osc_user_name();
$mobile = osc_user_phone_mobile();
$msgs = "Thank You $name, You have Successfully Registered with Classified123.";
$msgb = urlencode($msgs);
$stra ="http://sms.website.in/api/mt/SendSMS?user=user&password=pw&senderid=ABCDEF&channel=Trans&DCS=0&flashsms=0&number=$mobile&text=$msgb&route=15";
file_get_contents($stra);
/////SMS End

Related

bot.telegram.getChat does not return the message of a specific user

I am trying to setup my bot so that it will 'listen' to a specific user and print out any incoming message.
I have already setup a bot in telegram using BotFather. This is what I have so far
const { Telegraf } = require('telegraf')
const bot = new Telegraf('my_bot_token_here');
bot.telegram.getChat(Chat_Id).then(function(chat) {
console.log('chat info', chat);
});
The object does not contain the user message.
Any advice on this is appreciated.
Yes, absolutely. You need to check the 'from' field in the message before executing your logic.
Telegram API

How To Send GCM Message More Then 1000 users in one time

I am new to php and GCM. i am using following code to send gcm message using php and mysqldb as i am getting notification successfully however the android guidelines state that gcm message should be send in batch of 1000 each so i am looking for a solution so i can send notification in chunks so all user will receive the notification. i have seen some answers on some similar question but no one seems to be as much detailed for a beginner.
My question is that how i will be able to send GCM message more then 1000 user in one time as i have more then 20,000 users in my scenario. how i will be able to make 1000
Below Is The Code
<?php
include_once 'db_functions.php';
$db = new DB_Functions();
$appId= $_POST["appIdSelect"];
if($appId==0)
{
echo "App not selected, Please choose app first!!";
return;
}
$users = $db->getAllDevicesByAppId($appId);
$message = $_POST["message"];
$message = array("alert" => $message);
$i=0;
while ($row = mysql_fetch_array($users)) {
$regId = $row["device_id"];
//$regId."<br/>";
include_once './GCM.php';
$gcm = new GCM();
$registatoin_ids = array($regId);
$result = $gcm->send_notification($registatoin_ids, $message);
$result;
$i++;
}
echo "Notification send to APP ID= ".$appId." successfully. Total notification sends = ".$i;
?>
The 1000 limit is for when using the registration_ids parameter.
For your scenario, it is suggested to make use of Topic Messaging. Depending on which platform your users are, you simply have to have them subscribe to your topic, and as soon as you send a message to that topic, all subscribers will receive that message.
With all that said, is there a reason why you're not using the newer version of GCM which Firebase Cloud Messaging (FCM)?

How to edit the registration email sent by buddypress for activating users

I have this message when users register on my site, this is an excerpt of what is sent to the user and the email header message was incomplete. Take a look at what is sent when a user register
Email Subject = "[WWW Sites] Activate \http://1/"
And the email body message reads as below
"Thanks for registering! To complete the activation of your account and blog, please click the following link:
http://www.com/activate/?key=8b9c059db8ae9a5b
After you activate, you can visit your blog here:
\http://1/
So it is this incomplete messages that I would want to edit.
Thanks for your anticipated response
You have go through the filter method used in Wordpress Because you can not changed the email text or subject directly from the file because the email are comming from Buddypress core file so you can use the filter method.
Please put below code in your theme functions.php file.
1.) Change the subject for Activation email put below code:
function change_activation_subject($subject) {
return __( "Change Activate Your Account Subject", 'buddypress' );
}
add_filter('bp_core_activation_signup_user_notification_subject', 'change_activation_subject');
2.) Change the email body for Activation email put below code:
function change_activation_email_body($message) {
return __( "Change Activate Email body", 'buddypress' );
}
add_filter('bp_core_activation_signup_user_notification_subject', 'change_activation_email_body');

Sending email through Appcelerator Cloud API

I was trying to send email through Appcelerator Cloud Service, in my Titanium app. The code I'm using is the standart one, given at the documentation site. But the email is not being sent.
Cloud.Emails.send({
template: 'welcome',
recipients: '*******#gmail.com'
},
function (e) {
if (e.success) {
Titanium.API.info('Email sent successfully.');
} else {
Titanium.API.info('Error:\\n' +
((e.error && e.message) || JSON.stringify(e)));
}
});
It give the this error, 'Email template welcome is not found'. I was thinking that template is the message to be sent in email. There is no help on API about this attribute , template. Can anybody explain it to me? I'll be thankful.
Thanx
The error shows that you haven't created an email template on the ACS website yet. The following steps will help you to create email template
Log in to your Appcelerator App Console
click "Manage ACS" under the app you're working on
click the "Email Templates" tab
"Create an Email Template".
also you can setup your SMTP settings as follows which worked for me.
Username: ________#gmail.com
Password: gmail account password
TLS: true/ false (both will work)
SMTP Address: smtp.gmail.com
Port: 587
Domain : www.gmail.com
That error means you haven't created an email template on the ACS website yet. Log in to your Appcelerator App Console, click "Manage ACS" under the app you're working on, then click the "Email Templates" tab, and "Create an Email Template".

How to give option for resend verification email to user?

i am working on rails3 application. In my application when a user registered first time, an email has been sent to user with a verification link, after clicking that link i update the status_id and redirect user to login page. Here is my code :
code for token generation:
require 'digest/sha2'
class Subscription < ActiveRecord::Base
validate :ids_must_be_present, :on => :create
def ids_must_be_present
if status_id==0
generate_token
else
errors.add('Something gone wrong')
end
end
def generate_token
self.token = encrypt_string(id, generate_salt)
end
def encrypt_string(id, salt)
Digest::SHA2.hexdigest(id.to_s + "prftnxt" + salt)
end
private
def generate_salt
self.object_id.to_s + rand.to_s + company_id.to_s + Time.now.to_i.to_s
end
end
code to send email with link:
def email_verify
if subscription = Subscription.find_by_id_and_token(params[:id], params[:token])
subscription.update_attribute(:status_id, 1)
redirect_to("/login/index", :notice => "Thanks, email successfully verified")
else
flash.now[:notice] = "Your email has not verified yet. Please verify your email by clicking the link we have sent you."
end
end
Email template with verification link:
Hello <b><%= #user.username %></b>,
<br/>
<br/>
Thank you for signing up .
<b> Please Verify your email</b>
<%= link_to "verify", "http://localhost:3000/login/email_verify?token=#{#subscription.token}&id=#{#subscription.id}"%>
</br></br>
</br>
Now everything is fine, now my client want if user did not get verification email, then we some where give the option or link to request to resend verification mail.
i am thinking on to display flash msg on login attempt with a link to request for email.
but i am confused how do i do this any example or help would be helpful thanks.
Hi friends i got a solution, i have used a method in login controller that check the email is verified or not and if not verified a flash message displayed. The message contains the link .
When a user click on that link i resend the verification mail.
Here is my code:
subscription = Subscription.find_by_company_id_and_plan_id(current_company.id, current_company.plan.id)
link = "<a href= '/login/resend_verification_email'>Click</a>"
if subscription.status_id == 0
flash[:error] = "Your email is not verified. Please verify before login. <br/> #{link} here to resend verification email.".html_safe
redirect_to :back
end
and in login controller:
def resend_verification_email
subscription = Subscription.find_by_company_id_and_plan_id(current_company.id, current_company.plan.id)
Email.verify_email(current_user, subscription).deliver
redirect_to :back
flash[:success] = 'Verification email has been resend successfully, please check your inbox.'
end