I don't receive the email of sender who submit the form with details (name,email,message)? - express

I am using nodemailer for sending email, but email of sender is not receiving by using req.body.email.
See
This is my code:
var mailOptions = {
from: req.body.email, // sender address
to: "btazeem#gmail.com", // list of receivers
subject: "New message from Code4Share visitor 📧💭", // Subject line
text: req.body.message // plaintext body
}

Did the UI pass the data variable name "email" ? Show the UI form code and console.log(req.body) output.

Your req.body.email may have same value as btazeem#gmail.com

Related

Is it possible open mail or phone call with Linking.openURL in react native?

I need to make a call when I click on the button, or open mail in order to send a message, we usually use the a tag with the necessary mail: or tel: attributes for these purposes, but is it possible to do this using Linking.openURL like this?
onPress={() => Linking.openURL('+380775454545455')
If it possible, what should we add in order to do it?
Mail:
const subject = "Mail Subject";
const message = "Message Body";
Linking.openURL(`mailto:support#domain.com?subject=${subject}&body=${message}`)
Phone call:
const phone = "+380775454545455";
Linking.openURL(`tel:${phone}`)
As referred to in the react-native's documentation you can open your mail or make a phone call using the Linking component.
Phone call:
const phoneNumber = "+123456789";
Linking.openURL(`tel:${phoneNumber}`);
Email:
const email = "support#expo.io";
// if you want to just open the mail app
Linking.openURL(`mailto:${email}`);
// if you want to open the mail app with subject and body
const subject = "Subject";
const body = "Body";
Linking.openURL(`mailto:${email}?subject=${subject}&body=${body}`);
You can also use the component to open a website, send an SMS, or even open other apps through Deep Linking. For further explanation please see the documentation

React Native Forms Handling on Submit Button

I am new to React Native. I am building an app where there is a contact form in it. I want to collect all the forms field data and want to send these details entered by the users to a specific email on clicking Submit button.
How can I achieve this?
Thanks In advance
Am not sure if you can send email directly from react native app directly.
You can try using react-native-email package. Its quite easy to integrate. The package uses Linking API
import email from 'react-native-email'//imports the package
handleEmail = () => {//function to send email
const to = ['tiaan#email.com', 'foo#bar.com'] // string or array of email addresses
email(to, {
// Optional additional arguments
cc: ['bazzy#moo.com', 'doooo#daaa.com'], // string or array of email addresses
bcc: 'mee#mee.com', // string or array of email addresses
subject: 'Show how to use',
body: 'Some body right here'
}).catch(console.error)
}
}

React-Native: The subject line of email is same as the message contents using Share.share

It's a pretty strange problem I have been facing. I am using Share.share which takes message, subject(ios) and title (for gmail) as an argument. In the android it works fine. i.e. The subject line is "I am the title" whereas the message body is "I am groot". But in iOS, the subject line is always same as the message, like the screenshot shown below: Any help would be highly appreciable. Thanks in advance.
onShare = async () => {
try {
await Share.share(
{
message: "I am groot",
title: "I am the title",
},
{
subject: "I am the subject line",
}
);
} catch (error) {
...
}
};
Instead of importing Share from react-native, when I imported it from react-native-share, it fixed my problem.
As per the documentation, Share title property is used only as a title for the message. To set the email subject you need to set the subject property in the options object (note: this only works on IOS)

How to use DirtyKeys to know if "email" field in PFUser has been modified?

I'm using cloudcode of Parse-Server and mailgun to send email-verification Code to users that signup or change their email.
The BeforeSave Method :
Parse.Cloud.beforeSave(Parse.User, function(request, response) {
var verificationCode = Math.floor(Math.random()*999999);
var text = "Hi ... this is a verification code:" + verificationCode;
var data = {
from: 'WBP Team <info#test.eu>',
to: request.object.get("email"),
subject: 'Please verify your e-mail for you Account',
text: text
};
mailgun.messages().send(data, function (error, body) {
if (error) {
response.error("Email not sent..."+error);
}else{
var user = Parse.User.current();
user.set("emailVerificationCode", verificationCode);
user.save();
response.success("Email Sent");
}
console.log(body);
});
});
Now the email is sent everytime the user modify any filed. But I would like to use the method only when the user change the email.
This has been answered here: you just check if request.object.dirtyKeys() contains "email"; if this is the case, the email property was changed, and you can send your verification.
Note that this check also catches the first saving (i.e. creation) of a user; if you want to avoid sending a mail then, you can use request.object.isNew() to find out if the operation is a create or an update.

Not able to Send calendar event Request with attachment O365-ASPNETMVC

I am trying to add attachment to calendar. As it requires event id I can't add using method AddCalendarEventAsync. So I'm trying to below code:\
var outlookServicesClient = await AuthenticationHelper.EnsureOutlookServicesClientCreatedAsync("Calendar");
await outlookServicesClient.Me.Calendar.Events.AddEventAsync(newEvent);
var thisEventFetcher = outlookServicesClient.Me.Calendar.Events.GetById(newEvent.Id);
await thisEventFetcher.Attachments.AddAttachmentAsync(attachments[0]);
File is Attached to calendar event when i open 365 office calendar, but To Recipients didn't get any attachment.The problem is First event created after based on Id add the Attachment,
so before executing AddAttachmentAsync method mails are send to Recipients.
Ref link https://github.com/OfficeDev/O365-ASPNETMVC-Start
Can you please suggest me how to handle this issue.
Thanks,
Hemanth.
After the organizer adding the attachments, it is need to update the event. For example, we can change the body of event like below:
await thisEventFetcher.Attachments.AddAttachmentAsync(fileAttach);
IEvent eventToUpdate =await thisEventFetcher.ExecuteAsync();
ItemBody newBody = new ItemBody
{
Content = "Status updates, blocking issues, and next steps.(Update)",
ContentType = BodyType.Text
};
eventToUpdate.Body=newBody;
await eventToUpdate.UpdateAsync();