I want to send mailers in the background without starting them.

Asked 2 years ago, Updated 2 years ago, 100 views

I use monaca to create a hybrid app.
By pressing the button, I would like to automatically send mailers to the email address held in the application without starting the mailer.
If it's ios, mailto, android, you can use webintent, etc. to start the mailer, but I don't know how to send it automatically (background).
Please let me know what you can think of.

android ios monaca

2022-09-30 18:18

3 Answers

Do you want to create a smtp plug-in or launch your own relay web service?


2022-09-30 18:18

Share previously successful methods

I used an open source created by Kou called FrontierMail.
(The update has been stopped for 4 years, so it will work in the latest environment or not verified)

Follow these ReadMe instructions to create the framework.
https://github.com/kkoudev/FrontierMail

You can add Framework to your project and send email with the following implementations:

Test Class Implementation Quote

-(void)testSMTPSendPlainText{

    // create an e-mail message
    FRMailMessage* message = [FRMailMessage mailMessage];

    // set a subject line
    [message setSubject:MAIL_SUBJECT];

    // set the FROM name and address
    [message setFromAddress: [FRMailAddress mailAddressWithName:MAIL_FROM_NAME address:MAIL_FROM_ADDRESS]];

    // set a destination name and address
    [message addToAddress: [FRMailAddress mailAddressWithName:MAIL_TO_NAME address:MAIL_TO_ADDRESS]];

    // Create MIME Parts
    FRMimePart* mimeTextPart= [FRMimePart mimePart];

    // set up the text
    [mimeTextPart setText:MAIL_MESSAGE];

    // configure MIME information for mail messages
    message setMimePart: mimeTextPart;

    // Create an SMTP Session
    FRSMTPSession* session = [FRSMTPSession]
                               smtpWithConnectionType:FRSMTPConnectionTLS 
                               hostAddress:SMTP_HOST
                               portNo —SMTP_PORT_NO ];

    // connect to a session
    session connect:SMTP_ACCOUNT password:SMTP_PASSWORD;

    // send an e-mail
    session sendMailMessage:message;    

}

I used my Gmail account as an SMTP server.
SMTP_ACCOUNT and SMTP_PASSWORD have their own Gmail account name and password.


2022-09-30 18:18

There is a library called MailCore2 for sending and receiving mail.
https://github.com/MailCore/mailcore2

It seems that both iOS and Android are still being updated.


2022-09-30 18:18

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.