Skip to content

app crashed when loggedin user trying to replay any mail for first time #16

@PrantikMondal

Description

@PrantikMondal

0

I am using react-native-mailcore library to reply mail. As per the instruction on that library doc, i am doing smtp login before calling MailCore.sendMail. From second time reply mail is working fine with same code as well as For compose mail i am using same code to send mail. It is working fine for that case also. My code is given bellow.

import MailCore from 'react-native-mailcore';
var LocalStorage = require('react-native-local-storage');

sendMail = async () => {
let user = await LocalStorage.get('user');
await MailCore.loginSmtp({
hostname: 'smtp.gmail.com',
port: 465,
username: user.email,
password: user.password,
}).catch(error => ToastAndroid.show(error,ToastAndroid.LONG))
// All the values from the state are coming correctly
let subject = this.state.subject || '(No Subject)';
let body = this.state.compose + this.state.body || '';
let from = {
addressWithDisplayName : this.state.name,
mailbox: this.state.user,
}
let to = {[this.state.to] : 'to labels'};

// App crashed here while called sendMail

await MailCore.sendMail({
  headers:{
    isEncrypted: 'true',
  },
  from:from,
  to:to,
  subject:subject,
  body,  
}).then(()=>{
    this.goBack(); //navigating to main page after success
    ToastAndroid.show("sending...",ToastAndroid.SHORT);
}).catch(err => ToastAndroid.show(err,ToastAndroid.LONG));

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions