Unable to send mail using SKPSMTPMessage - ios

I am using SKPSMTPMessage to send emails in background and it is working too. But the problem arises in one particular case. There is a part where I have to use a string returned from a webApi as the email body. The SKPSMTPMessage delegate shows sending successful but the mail is never received. I have tried changing the returned string in various ways like removing newline characters and whitespace characters too. The weird part is that when I change a particular Capital (A -in approve) letter to small letter, the mail gets delivered.
The string I am using as mail body is :
You have new App registration Approval request.
Name:rktest26
Email :rktest26#test.com
Mobile
Phone:
Address:a1asssaasssa
To Approve please click the below link.
(some link)
ClientId=38&EmailId=rktest26#test.com&Approved=1
To Reject please click the below link.
(some link)
If I remove the string content after Address:a1asssaasssa part, it gets delivered.
What can I do so that the whole message gets delivered?

Related

URL scheme as to send a request with *...# syntax

Normally, in default calling application of iPhone ,I open number keyboard and pressed *100*stringnumber# (example *100* 12345678989 #), and press call button , it make a request to add money to my sim card account.
Now, I make an app, that it scan the string number auto by camera, and I want after scan that string, it can send the request to add money like the way in calling application.
I make an URL scheme with string: "tel:*100*stringnumber#" and send it to open calling app, but it didn't work, I search and know it just for dialog a phone number.
Is there any way or syntax to do that?

Sending message with custom URL though Geoloqi

I'm looking into Geoloqi as a service for sending messages and I'm wondering about the url parameter described here:
https://developers.geoloqi.com/api/message/send
Can I use a custom protocol/URL scheme to launch my app in response to a sent message.
(I would assume yes, but need to be sure before progressing further with it).
According to the web page you've linked, one of the parameters that can be sent along with the "POST" is a URL that can be opened when the notification is tapped.
It's here that I think you could put your custom URL. No way to know if the server will accept a custom scheme (e.g. "bradrobinson://hi/there") though without trying.

How to send background email after button press?

I'm building an internal app. I want to be able to press a button, and have the app automatically send a predefined email message to a specified email address, without the user knowing. I have access to a web-server, but I'm just not quite sure on what the best way to go about doing this is.
I'm using storyboard in xcode, this is a singleview application for the ipad.
Any suggestions are greatly appreciated.
You can create a PHP script that can do this (code below). Use a library such as ASIHTTPRequest to post the user's email address to the script and then the script will automatically send the message.
<?php
$to = $_POST["email"]; //this is the user's address; you can replace $_POST["email"] with "user#example.com" to try it out
$subject = "Subject";
$body = "Message";
$headers = "From: Name <noreply#example.com>\r\n" . "X-Mailer: php";
if (mail($to, $subject, $body, $headers)) {
//sent
}
?>
If you want to use the user's mail account that they have set up in the mail.app - you can't do that without the MFMailComposeViewController.
Solutions are:
Use some Framework or roll your own mail solution that you or the user fills with their respective mail acc data and then send mails.
or
Write a little PHP/Ruby/Java/... script that sends a mail which you can trigger via web request (i.e. REST).
SKPSMTPMessage works well for sending emails without the need for a UI.
(Make sure you add a reference to the CFNetwork.framework in your project.)

Is it possible to create an MMS which contains a url link to launch a local app

I can launch my app if I embed a url in an SMS and then the user clicks on the url from within the message app. I have this all working.
What I would like to be able to do however is send an MMS to the device which contains a number of image(s) and text filling the screen and when the user clicks on the url within the MMS my app is launched same as it is if clicked from within an SMS.
Is it possible to mock this up so I can see it working? i.e. how could I create an MMS containing a working active link to demo a proof of concept (I'm not talking about creating an MMS programatically on iOS, just how to create one containing my app's url to send to the device)?
Edit: This answer was written under the assumption that implementation details were required for the URL handling part. I'll leave the technical details here for future Googlers.
Here is a link to a forum thread which seems to indicate you can't send MMSes from the iPhone programmatically (I know you said you didn't want to know this anyway, but it's here for completeness). The suggestion is to use a message provider's MMS gateway directly (e.g http://www.smsglobal.com).
Instructions on how to get a hyperlink into an MMS are here. You can just write it in plain text, or use an anchor: <a href="myapp://"> Not 100% sure the iPhone will properly parse those anchor tags in an MMS though.
Read this article. The gist is that you add a "URL types" row to your Info.plist and set it to any valid protocol, say myapp, and then a user opens a link in an MMS to a myapp URL. Article excerpt:
myapp://
myapp://some/path/here
myapp://?foo=1&bar=2
myapp://some/path/here?foo=1&bar=2
The iPhone SDK, when launching the application in response to any of the URLs above, will send a message to the UIApplicationDelegate.
If you want to provide a custom handler, simply provide an implementation for the message in your delegate. For example:
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
{
// Do something with the url here
}

SendGrid - Custom Event Notification App in header

I am trying to use SendGrid's Event Notification App (http://sendgrid.com/documentation/display/apps/EventNotification) for emails of certain categories. The Event Notification on my SendGrid account is empty. The header I'm putting on my email is:
X-SMTPAPI: {"category":"category","filters":{"eventnotification":{"settings":{"url":"theurl"}}}}
But I'm not getting a callback on my url. A simple curl post on this given url gives me the expected output, so I'm pretty sure that should be working with SendGrid too.
Do you have any ideas on what the header should look like? I couldn't find too much documentation on the website for this specific app...
Thanks!
Here is an example of the header that I am successfully sending with my Sendgrid emails:
headers("X-SMTPAPI" => "{\"unique_args\": {\"customer_id\":\"#{customer.id}\",\"email_batch_id\":\"#{batch_id}\"}, \"category\":\"monthly_statement\"}")
Make sure you have the correct events checked under the event notification settings in Sendgrid.

Resources