我正在使用react native来构建移动应用程序,但是当我尝试发送电子邮件时遇到问题 . 它不发送附件 . 要发送电子邮件,我正在使用mailgun和axios .
import image from '../../assets/image.jpg';
axios({
method: 'post',
url: `${config.MAILGUN.baseUrl}/${config.MAILGUN.domain}/messages`,
auth: {
username: 'api',
password: config.MAILGUN.apiKey
},
params: {
from,
to,
subject,
text,
attachment: image
}
}, {
'Content-type': 'multipart/form-data'
}).then(
response => {
console.log('=========== RESPONSE =============', response);
this.setState({ ...EQ_SATE });
},
reject => {
console.log('=========== REJECT =============', reject);
}
)
此外,我试图发送这样的附件,也没有工作
attachment: {
path: image,
filename: test.jpg
}