I am developing a site in Visualforce and would like to offer user a simple form to send me feedback via email. There would be 3-4 fields like name, user’s email, reason and feedback and “send” button. Clicking the send button should automatically send that message to my email address.
I do not want to store the form data in salesforce at least for now…All the stuff I found online about visualforce/apex and email is about saving that data to salesforce too.
Can I just make use of apex’s email capabilities and send out email without storing that data anywhere in salesforce?
Thanks,
Calvin
It’s not required to insert/update/delete any records in the database when executing an action on a VisualForce page. You can leverage the Outbound Email functionality to send out your notification. For something like this, you will probably want to familiarize yourself with the SingleEmailMessage methods.
A simple example to get you going:
If you are interested in sending these outbound messages from a dedicated email address (something like noreply@somecompany.com), you can set these up through the Setup -> Administration Setup -> Email Administration -> Organization-Wide Addresses menu. Once you have created an org-wide address, grab the Id from the URL and use the
setOrgWideEmailAddressId(Id)method on your instance ofMessaging.SingleEmailMessage.