My question for you today is "How to reply to an email using windows vbscript." (Gmail) That may not be the best explanation...
WAIT, I already know how to SEND an email (to my phone through phonenumber#txt.att.net) using VBScript, but I want to reply to a text. I have a system that alerts my phone when an action is performed on my computer (through VBScript) but this keeps happening. It's as if I receive the message from a different address each and every time.
So, is there any way to make it so I receive the text from the same recipient each time? Currently, the "phone" number of the sender started at 1410200500 and counts up every time I send it using this vbs code.
Const schema = "http://schemas.microsoft.com/cdo/configuration/"
Const cdoBasic = 1
Const cdoSendUsingPort = 2
Set oMsg = CreateObject("CDO.Message")
oMsg.From = "myemail#gmail.com"
oMsg.To = "myphonenumber#txt.att.net"
oMsg.TextBody = "ALERTMSG"
Set oConf = oMsg.Configuration
oConf.Fields(schema & "smtpserver") = "smtp.gmail.com"
oConf.Fields(schema & "smtpserverport") = 465
oConf.Fields(schema & "sendusing") = cdoSendUsingPort
oConf.Fields(schema & "smtpauthenticate") = cdoBasic
oConf.Fields(schema & "smtpusessl") = True
oConf.Fields(schema & "sendusername") = "myemail#gmail.com"
oConf.Fields(schema & "sendpassword") = "supersecretpassword"
oConf.Fields.Update
oMsg.Send
Everything works except for the issue of the sender being different each time.
Please help
Edit: I have found that this is unavoidable, thanks to everyone that helped!
There is nothing wrong with your VBScript or the CDO configuration.
The value assigned to the Sender by the SMS Middleware that takes the e-mail and forwards it to an SMS service is outside your control. The only option you have is to contact your SMS provider but I wouldn't suggest they will change how this works.
In fact in this Video at 0:40 it states;
"the number that appears on your recipients phone or device may not be your actual phone number, but they will see the name, subject and e-mail address you used to send the text message."
Useful Links
Send email as text message (AT&T Support)
Related
According to the documentation,
The Push API gives web applications the ability to receive messages pushed to them from a server, whether or not the web app is in the foreground, or even currently loaded, on a user agent.
If properly implemented, this seems to suggest that Android Firefox would be able to handle push notifications, even though the app is in the background.
Indeed, this works completely fine for me on Android Chrome, but for Android Firefox, as soon as the browser has been in the background for a short period of time (a couple of hours seems to be enough on the Android 10 devices I tested this on), push notifications stop coming through, and they do not even show up once the browser is loaded again, even if I specify a TTL of 60*60*24.
More concretely, I have examples of users that subscribe to web push messages, and when sending the messages to the Mozilla push server, I'll always get 201 responses. The messages show up just fine when the browser is in the foreground, but again, after a while in the background, they'll stop showing up. I've specified "normal" for the "Urgency" header, and the output of Python's int(time.time()) + (12 * 60 * 60) for the VAPID expiry time.
I first suspected the TTL to be the culprit, but according to this blog post, I shouldn't be getting 201s if that were the issue.
My service worker looks as follows:
self.addEventListener("push", function(event) {
if (event.data) {
data = event.data.json()
showLocalNotification(data.title, data.message, self.registration);
}
});
const showLocalNotification = (title, body, swRegistration) => {
const options = {
body: body,
badge: "/badge.png",
icon: "/plug-512.png",
};
swRegistration.showNotification(title, options);
};
I've tried adding a trivial event handler for fetch but that makes no difference either.
I use pywebpush to make the requests to the push servers and py_vapid to handle signing; the concrete implementation takes a string called data and the user-provided subscription_info, and creates a request as follows:
import time
from urllib.parse import urlparse
from pywebpush import WebPusher
from py_vapid import Vapid
def send_push(data, subscription_info):
subscription_info = row
pusher = WebPusher(subscription_info)
url = urlparse(subscription_info['endpoint'])
aud = "{}://{}".format(url.scheme, url.netloc)
vapid_claims = {'sub': 'mailto:mail#example.com'}
vapid_claims['aud'] = aud
vapid_claims['exp'] = int(time.time()) + (12 * 60 * 60)
vv = Vapid.from_string('my-key')
vapid_headers = vv.sign(vapid_claims)
vapid_headers['Urgency'] = 'normal'
resp = pusher.send(data, vapid_headers, ttl=60*60*24)
assert resp.status_code == 201
The app is currently live here.
I'm doing my final year project about flood push notification. Previously, a user will retrieve notifications whenever the value in database changes from 0 to 1. But right now,in my app, the user can choose which places he parks his car and he can retrieved status and notification based on the park's place whether it's zero or one. As for example, User A set his spinner value in Mid Valley and User B set his spinner value in KPS. User A will get notification when FLOOD_STATUS_MID_VALLEY is 1, while User B didn't receive any notifications because FLOOD_STATUS_KPS is still 0. Anyone can help me on how to send notification based on the spinner value in the app?
Screenshot of my app
Screenshot
below is the python code that running on server to send notification based on a value called "FLOOD_STATUS" in firebase database
from pusher_push_notifications import PushNotifications
config = {
'apiKey': "APIKEY",
'authDomain': "car-app-push-notification.firebaseapp.com",
'databaseURL': "https://car-app-push-notification.firebaseio.com",
'projectId': "car-app-push-notification",
'storageBucket': "car-app-push-notification.appspot.com",
'messagingSenderId': "596729642105",
'appId': "APPID",
'measurementId': "G-9LMJGS1BDW"
}
firebase = pyrebase.initialize_app(config)
db = firebase.database()
beams_client = PushNotifications(
instance_id='49f62b05-bd81-4040-ab57-80afa56a8680',
secret_key='SECRET KEY',
)
def stream_handler(message):
print(message)
if(message['data'] is 1):
response = beams_client.publish_to_interests(
interests=['hello'],
publish_body={
'apns': {
'aps': {
'alert': 'Hello!',
},
},
'fcm': {
'notification': {
'title': 'Alert!',
'body': 'It is starting to flood, please remove your car immediately!',
},
},
},
)
print(response['publishId'])
my_stream = db.child("FLOOD_STATUS").stream(stream_handler,None)
As this is your FYP, I won't provide any code for this.
When a user changes where they parked, you will want to change their device interest to match the relevant location.
When the FLOOD_STATUS is updated to 1 for a given location, you send the notification to the matching interest.
I suggest that, when the user A select the MID_VALLEY in the Spinner you send the selected value to the server. I recommend you to have a look on this tutorial to see how to get the selected value from Spinner
At server side, when the FLOOD_STATUS_MID_VALLEY is 1 you only send the notification to the user A(because you knew the FCM token of the user A).
If you want to custom the item of Spinner you can watch this tutorial.
I got this Unauthorized null message when I try trigger node script for my push notification.
I'm using this sample code for my push notification.
https://github.com/hollyschinsky/PushNotificationSample30/
Please refer this site for your reference.
http://devgirl.org/2013/07/17/tutorial-implement-push-notifications-in-your-phonegap-application/
I already check this solution but it still didn't work. Why?
node.js returns null push messages
After I insert the correct API key, we got authorised but null.
Actually "null" in the case means it is a success. The problem is when you run your application in local environment and the device is connected to wifi. There is a certain case that firewall block the traffic from the outgoing connection ports which are used by GCM (5228,5229,5230).
You can refer to the site as a reference
http://developer.android.com/google/gcm/http.html
Looks like you have not registered for an api key. This is from the url you posted.
var gcm = require('node-gcm');
var message = new gcm.Message();
//API Server Key
var sender = new gcm.Sender('AIzaSyCDx8v9R0fMsAsjoAffF-P3FCFWXlvwLhg');
var registrationIds = [];
// Value the payload data to send...
message.addData('message',"\u270C Peace, Love \u2764 and PhoneGap \u2706!");
message.addData('title','Push Notification Sample' );
message.addData('msgcnt','3'); // Shows up in the notification in the status bar
message.addData('soundname','beep.wav'); //Sound to play upon notification receipt - put in the www folder in app
//message.collapseKey = 'demo';
//message.delayWhileIdle = true; //Default is false
message.timeToLive = 3000;// Duration in seconds to hold in GCM and retry before timing out. Default 4 weeks (2,419,200 seconds) if not specified.
// At least one reg id required
registrationIds.push('APA91bwu-47V0L7xB55zoVd47zOJahUgBFFuxDiUBjLAUdpuWwEcLd3FvbcNTPKTSnDZwjN384qTyfWW2KAJJW7ArZ-QVPExnxWK91Pc-uTzFdFaJ3URK470WmTl5R1zL0Vloru1B-AfHO6QFFg47O4Cnv6yBOWEFcvZlHDBY8YaDc4UeKUe7ao');
/**
* Parameters: message-literal, registrationIds-array, No. of retries, callback-function
*/
sender.send(message, registrationIds, 4, function (result) {
console.log(result);
});
I am using rapns to provide GCM and APNS support. For APNS, I know what unregistered device I must delete via on.apns_feedback (rapns.rb):
on.apns_feedback do |feedback|
device = AppleDevice.find_by_token(feedback.device_token)
device.destroy if device
end
but for GCM, I can't find a way to know what device is unregistered so I can delete it from my database.
I tried with the reflection API, but I'm not getting on.notification_failed and on.error called whenever a Rapns::DeliveryError exception is raised and those methods doesn't seem to give me a way to know the unregistered tokens.
I tried catching the Rapns::DeliveryError, but it doesn't seem to work.
messenger = PushMessenger::Gcm.new
GoogleDevice.find_in_batches :batch_size => 1000 do |devices|
tokens = devices.map(&:token)
begin
messenger.deliver(app, tokens, payload, nil, true)
rescue Rapns::DeliveryError => error
GoogleDevice.destroy_all # Just to see it works
end
end
PushMessenger:
module PushMessenger
class Gcm
def deliver(app, tokens, payload, collapse_key=nil, delay_while_idle=nil, expiry=1.day.to_i)
tokens = *tokens
n = Rapns::Gcm::Notification.new
n.app = app
n.registration_ids = tokens
n.collapse_key = collapse_key
n.delay_while_idle = delay_while_idle
n.expiry = expiry
n.data = payload
n.save!
end
end
end
How can I know the token for these unregistered devices so I can remove them from my database?
I'm using rapns to do pretty much the same, so here my two cents:
First, for Android devices you don't need the device_token to deactivate/remove the device (On GCM device_token == registration_id). You can get that registration_id from the on.notification_failed callback with the Reflection API.
Last, which version of rapns are you using? Right now the last version (3.4.1) has a bug with on.notification_failed, but version 3.3.2 works just fine and you'll be able to do something like:
on.notification_failed do |notification|
device = Device.find_by_token(notification.registration_ids.first)
device.destroy if device
end
Hope that helps.
I am developing an android application..in that application there is a registration module.for that i have to implement email verification functionality.
by using the following code I am able to send email for particular email..
public void onClick(View v) {
// TODO Auto-generated method stub
try {
GMailSender sender = new GMailSender("username#gmail.com", "*******");
sender.sendMail("This is Subject",
"This is Body",
"rose.jasmine87#gmail.com",
"naresh_bammidi#yahoo.co.in"
);
} catch (Exception e) {
Log.e("SendMail", e.getMessage(), e);
}
}
but how to know the status, whether it has been sent or not?
I'm assuming that you're using GMailSender as defined in this post.
Internally GMailSender calls Transport.send(message) which will throw an exception if the send to the GMail server is unsuccessful, but this is being caught and suppressed, so your calling code has no way of knowing whether sending was successful. Firstly you'll need to change the GMailSender code to do something a bit more meaningful in the case of a send error.
What you must remember is that email is not delivered directly to the final recipient by your app or even the GMail server. Just because you managed to send correctly to the GMail server, does not mean that it will actually reach its intended recipient, as it could fail at any mail relay on its route. To properly detect and report on whether mail actually reaches its destination you'll need something a little more sophisticated than this.
RFC 1891 is an extension to the SMTP protocol which supports delivery status notifications, but you may need to re-architect your app to be able to use this. Essentially it works by setting flags in your outgoing message to instruct mail relays to inform you of the message status. In order for you to receive this notification, you must essentially have your own mail server which is capable of receiving emails. You will receive an email containing, for example, a delivery report once a mail relay has successfully delivered it to the recipient's mailbox.
So, to properly implement this, you'll need a mail account for your app which will receive delivery status notifications. You'll need to create an SMTPMessage object, and add a header including a "Return-Receipt-To" header, whose value is set to this mail account. You'll also need to setNotifyOptions() on your message, and then send it to the GMail server. Your app will need to check its account periodically for delivery notifications.
This is a purely email-centric approach. Without knowing your precise requirements, there are alternate mechanisms that you can use. For example, if your requirement is purely to verify that an email address exists, then you can send an email which contains a URI to a server that you control. The URI contains parameters which uniquely identify both the user, and the installation of your app. The user must click on the link, and your server component verifies the mail account. It can then use something like C2DM to inform your app that the mail account is real and valid.
Sorry if this answer is a little long, and does not offer you a simple solution, but if you want to be able to properly determine whether mail is reaching its recipient, then there is no simple answer, I'm afraid.
check below method, which will validate email from client side, simply pass mail string it will return a boolean, whether entered email is correct or not.
public boolean isEmail(String email)
{
boolean matchFound1;
boolean returnResult=true;
email=email.trim();
if(email.equalsIgnoreCase(""))
returnResult=false;
else if(!Character.isLetter(email.charAt(0)))
returnResult=false;
else
{
Pattern p1 = Pattern.compile("^\\.|^\\# |^_");
Matcher m1 = p1.matcher(email.toString());
matchFound1=m1.matches();
Pattern p = Pattern.compile("^[a-zA-z0-9._-]+[#]{1}+[a-zA-Z0-9]+[.]{1}+[a-zA-Z]{2,4}$");
// Match the given string with the pattern
Matcher m = p.matcher(email.toString());
// check whether match is found
boolean matchFound = m.matches();
StringTokenizer st = new StringTokenizer(email, ".");
String lastToken = null;
while (st.hasMoreTokens())
{
lastToken = st.nextToken();
}
if (matchFound && lastToken.length() >= 2
&& email.length() - 1 != lastToken.length() && matchFound1==false)
{
returnResult= true;
}
else returnResult= false;
}
return returnResult;
}