Is it possible to send an automatically generated email using my own email address to another email address of mine by clicking a button?
I tried to use MFMailComposeViewController but another view appeared. Can I do it without this view?
You can do it only by creating own server-side mailer. On button clicking you have to send request with all needed data (email address, body, subject, etc) and server will send mail.
If You want send directly from app - MFMailComposeViewController is the only LEGAL way
By default in iOS you can only use the MFMailComposeViewController, which uses the user's mail account. Therefore you cannot send fully automated mail messages (the user allways has to confirm/cancel).
libMailCore is a great iOS framework which allows you to generate and send mails without any user interferance. In that case you'll be using your own server/credentials (thus not the user mail account). There are apps in the App Store using mailcore, so i would guess it's legit.
Yes there is a way using Swift-SMTP.
Send email
Create a Mail object and use your SMTP handle to send it. To set the sender and receiver of an email, use the User struct:
let drLight = Mail.User(name: "Dr. Light", email: "drlight#gmail.com")
let megaman = Mail.User(name: "Megaman", email: "megaman#gmail.com")
let mail = Mail(
from: drLight,
to: [megaman],
subject: "Humans and robots living together in harmony and equality.",
text: "That was my ultimate wish."
)
smtp.send(mail) { (error) in
if let error = error {
print(error)
}
}
Related
I have created a template in docusign web and using its template id, i am calling the function from iOS SDK.
TemplatesManager.sharedInstance.displayTemplateForSignature(templateId: templateId, controller: self, tabData: tabData, recipientData: recipientData, customFields:customFields, onlineSign: onlineSign, attachmentUrl: attachmentUrl) { (controller, errMsg) in
print(errMsg)
}
The recipient data i am sending is
let recipientDatum = DSMRecipientDefault()
// Use recipient roleName (other option to use recipient-id) to find unique recipient in the template
recipientDatum.recipientRoleName = "Client"
recipientDatum.recipientSelectorType = .recipientRoleName
recipientDatum.recipientType = .inPersonSigner
// In-person-signer name
recipientDatum.inPersonSignerName = "Akshay Somkuwar"
// Host name (must match the name on the account) and email
recipientDatum.recipientName = "Akshay Somkuwar"
recipientDatum.recipientEmail = "akshay.s.somkuwar#gmail.com"
let recipientData: Array = [recipientDatum]
Same recipient is added for template in docusign website
Also i have added observers for DSMSigningCompleted and DSMSigningCancelled to get envelopeId.
Now when i am calling this function displayTemplateForSignature no screen is opening to show the PDF or To sign the PDF, without asking for signature, the envelope is directly sent to the recipient. and i am getting this response in console with notification.
name = DSMSigningCompletedNotification, object = Optional(<Public_Adjuster.AgreementSignViewController: 0x110bb8060>), userInfo = Optional([AnyHashable("templateId"): 506346f5-7adb-4132-b15f-d288aa268398, AnyHashable("signingMode"): online, AnyHashable("envelopeId"): 2eeeeda8-5b74-4930-904e-94b2ce6451ac])
I want to open the pdf for the passed templateId but its not opening the pdf nor its asking for signature, and its directly sent to the recipient.
Any help will be appreciated, Thank you.
This behaviour, sending the envelope directly, is triggered when DocuSign SDK can not find any signers in the template/envelope that matches the logged-in user. Given that you are using the recipientDefaults, ensure that your signer information on the template (preset signer on the DocuSign web) matches the Account information exactly with the recipientDefaults object.
You may compare it with .
One issue I noticed is the signer type is set to need to sign which corresponds to a remoteSigner on the DocuSign web. And on the recipientDefaults object it's set as inPersonSigner. It should be .signer corresponding to DSMRecipientTypeSigner.
recipientDatum.recipientType = .signer.
Or you may change the need to sign to in person signer on the DocuSign web.
Another suggestion is to remove the name & email from the template screenshot shared and keep that empty as the client app is passing name & email with the recipientDefaults object to the SDK.
More details: How to set recipient defaults
A client of mine is having an issue where he'll use our app to send an email with an auto generated PDF that's attached to the email and sometimes it will work and sometimes it will not.
Things We've noticed:
When sending from his gmail account, it typically fails and the email is sent out with a blank message and an attachment that reads 'noname'.
Sometimes, when selecting his personal email, the app still sends the email from his gmail account. I was able to reproduce this on an iPad Pro and can verify that when I select one email, it shows it was sent from another.
Removing the gmail account from the iPad and readding it back usually
fixes the problem for the first email sent and then it goes back to
the normal problem stated in the first bullet.
Here is the code where I create the MailComposer view:
func configureMailComposeViewController() -> MFMailComposeViewController {
let mailComposerViewController = MFMailComposeViewController()
mailComposerViewController.mailComposeDelegate = self
if let fileData = NSData(contentsOfFile: GeneratePDF.attachEachPage()) {
mailComposerViewController.setSubject(Constants.EmailPreferences.subject)
mailComposerViewController.setMessageBody(Constants.EmailPreferences.message, isHTML: true)
mailComposerViewController.addAttachmentData(fileData, mimeType: "application/pdf", fileName: "overview")
}
return mailComposerViewController
}
The view opens up no problem, There's a title, body message, and an attachment. Yet, when received everything's been stripped except the title. The PDF is < 6MB and only has 5 pages.
I have been trying to receive emails in rails using IMAP and send a notification to user that new mail has come. I have a table namely "email" where i have to store the email information like message_from, message_to, message and i wanted to know how to fetch the emails from the gmail whenever a new mail comes in. And the following is the code
require 'net/imap'
require 'net/http'
imap = Net::IMAP.new('imap.gmail.com', 993, usessl = true, certs = nil, verify = false)
imap.login('sampleuser', 'password')
imap.select('INBOX')
imap.search(["NOT", "SEEN"]).each do |message_id|
emails = imap.fetch(mail,'RFC822')[0].attr['RFC822']
#mail = Email.new("from" => emails.from, "to" => emails.to)
#mail.save
end
but i cannot able to fetch the message_from or message_to or the message, it shows error as
TypeError (can't convert Symbol into Integer):
how can i get those details and i want to send notification to the user when a new entry is created in the table and clicking on that should take it to the page where i have to display the email.
How can i do this and should i be using something like scheduler to check if the new mail has come and if i am not reading the mail how can i identify that i have received the mail already and i do not want to duplicate. Please help me.
Your best bet on receiving emails is Griddler. It's easy to setup
You can send the email to the model you want and do the processing there.
I'm trying to send an email from my game. This is the function involved:
local function showMailPicker()
-- Create mail options --
local options =
{
to = "my#email.com",
subject = "some text",
body = " ",
attachment = { baseDir=system.DocumentsDirectory, filename="file.txt", type="text" },
}
-- Send mail --
native.showPopup("mail", options)
end
this function is then triggered on a touch event. but instead of getting straight to the email program on android, I get the selection menu for Facebook, Twitter, SMS, bluetooth, gmail, ...
Can this be avoided?
I would just ask, why would you want to bypass this?
I have my work email + hotmail account in the "email" application, plus a gmail account in the "gmail" app.
I would much prefer that it came up with the "which application would you like to use" when I try to send an email rather than going straight to the email app.
I am building an application where I need the option to share via email and SMS.
I have done the share via Email, where when the user selects the image, the url is passed as the content of the email. But while sharing via SMS, I can't do something like setContent as I did for email and fetch the url in the SMS directly, instead of user typing the address manually.
I am using Message class in email and MessageConnection class for SMS, as shown in the blackberry community example.
The Message object you receive when calling MessageConnection.newMessage(TEXT_MESSAGE) is actually a TextMessage object (or a BinaryMessage object with BINARY_MESSAGE).
If you cast the received object to the proper class (TextMessage or BinaryMessage), you should be able to use its setPayloadText(String data) (or setPayloadData(byte[] data) for a BinaryMessage) to enter a value in the message before sending it.
Your code should look like this:
Message msg = myMessageConnection.newMessage(TEXT_MESSAGE, /* address */);
TextMessage txtMsg = (TextMessage)msg;
txtMsg.setPayloadText(/* Text to send */);
myMessageConnection.send(msg);
When you send an email, you can set the body of it and send it to the user from the Email native application. You cant do taht for SMSs. I worked on that issue and for BB Torch I was able to set the text of the SMS message but for other devices that was impossible. I always obtain an empty text message!!
So y suggestion to you is using the following code wich will send the SMS to a number without the interference of the user
MessageConnection conn = (MessageConnection) Connector.open("sms://" + userNumber);
TextMessage txtmessage = (TextMessage) conn.newMessage(MessageConnection.TEXT_MESSAGE);
txtmessage.setPayloadText(text);
conn.send(txtmessage);