Force.com email service - email

I have created an email service in force.com.Can anyone help me out of how to use thta in apex classes.say,i wanna send mail when user registration is successful??
Many Thanks,
Sandhya Krishnan

I assume you want to send an email directly from Apex code, either in a Trigger or from a page controller ... ? If so, this page can get you started:
http://www.forcetree.com/2009/07/sending-email-from-your-apex-class.html
Clearly you don't want to hard-code your email template into your classes, so make sure to read at least through the part that shows how to look up the template dynamically. That should be enough to get you on your way.

Related

Mail stay in queue when i use Sendgrid in symfony6

I have set my Sendgrid single sender and validate it ( status = verified).
I use SMTP, create my key that i paste in my code (.env file of my app):
MAILER_DSN=sendgrid+smtp://#default
Then i try to test integration in Sendgrid by clicking on button and refresh my localhost/ page (of course the controller's route is "/" and it contains the code using mailer to send a mail as explain in mailer documentation).
On my vue i don't have error code but mail stay in queue status...
Here the screenshot taken of the profiler:
Can someone tell me why my mail stay queued?
Of course the From email address is mine ( the verified one) and the To is anotherone of mine.
Maybe i have to configure something in my outlook mail (the From one) ?
Sendgrid never match the verification, it stay in checking status until message :
Hmm, we haven't seen your email yet.
Please check your code, run it again, then click "Retry".
Thanks for reply,
Regards,
In your question you said that your MAILER_DSN environment variable is set to:
MAILER_DSN=sendgrid+smtp://#default
That is missing your API Key though. You need to create an API key in the SendGrid dashboard and then add the API key to the MAILER_DSN variable, between the // and the #default like this:
MAILER_DSN=sendgrid+smtp://API_KEY#default
One other thing, ensure that you have installed the SendGrid transport with this command:
composer require symfony/sendgrid-mailer
Yes, thanks you a lot for reply.
Of course all was set as you notify me.
I now have fix my issue, in fact the problem for me with the mail that remains in queued is that the messenger was installed so in asynchronous by default.
I had to add the option message_bus: false in my config/packages/mailer.yaml file not to have the asynchronous option used.
Hopefully this is useful for some people.
add the option message_bus: false in my config/packages/mailer.yaml:
framework:
mailer:
dsn: '%env(MAILER_DSN)%'
message_bus: false

Custom tags in Jira email handler

Is there a way to make a Jire email handler ignore the From field in an email and go for a custom tag instead? I know I could work with the API instead but that's in the pipe. this is a temporary solution that will be used until a more robust system is built.
To clarify what we have today:
Email is sent to inbox, (hr#company.com)
Jira picks is up and creates an issue.
Jira looks at the From field and creates a uses if none exist.
What we're trying to achieve:
Form is filled out, and an area is chosen (hr, facilities etc.).
Form is posted to an API that creates an email (basically a no-reply adress over SMTP) and sends it to the appropriate inbox (for example hr#company.com).
Email lands in the inbox and Jira looks in it and creates an issue in project or label 'HR'.
Jira now looks in the email and finds custom tags named [user] and [user-email] (or something) and creates a user from the tag.
Example email
From: no-reply#company.com
To: hr#company.com
Subject: Some problem
Body: Explanation of problem
Have a good day!
/Mike
[user:"Michael Smith"]
[userEmail:"michael.smith#company.com"]
If we were to implement this system now, we would loose the possibility to create new users because all emails would come from the same "no-reply" adress.
I have searched in the Atlassian forums and such, but with no luck. Have not found anything in the official documentation, but I fear that I might be looking in the wrong place.
I hope that I'm being clear, and that someone has any idea if it is possible.
Thank you!
You need to write your own plugin and create your own Mailhandler.
For example you can use a regex which looks for the tag
[userEmail:"michael.smith#company.com"] and retrieve the emailadress from the string. Do the same for the [user]-tag, if the user doesn't exist.
Here is a tutorial that shows how to create and setup custom Message Handlers:
https://developer.atlassian.com/jiradev/jira-platform/guides/email/tutorial-custom-message-mail-handler-for-jira#Tutorial-Custommessage(mail)handlerforJIRA-Step7:Implementarealmessagehandlerback-end
The rest should be easy from here.

load magento email template

I'm using my own code to send out SMS's to the customers at the same time as the emails go out. I do this by getting the email template code with
$code = $this->getTemplateCode();
and then trying to load the corresponding SMS template with
$sms = $this->loadByCode('sms_'.$code)->getTemplateText();
I then check if $sms is empty before proceeding to send the text, meaning that I can add or remove connected SMS templates at will. The problem I'm having is that I sometimes, when there is no connected "sms_*" template, I get the full email sent out as the SMS instead of no text being sent.
I've debugged the code by sending out the template it tries to load as the actual SMS, and received "sms_creditmemo", but when I instead load it with the method above and do a var_dump($sms); exit;it shows me that it loaded the template "creditmemo_invoice" which is the email template I use instead of "creditmemo" when the payment method is detected. I make sure to use the original template string in $code (used to load SMS template) no matter the payment method.
Now my question would be how this can even be possible, does the loadByCode take best matching template or is there some other more serious bug I've missed, maybe there's better ways to load in the templates and make correct checks to see if they even exist?
I solved this by checking if the correct email template gets loaded with
if ($this->loadByCode($template)->getTemplateCode() == $template)

Drupal email users

I'm using Drupal 6.16: When a user creates an account on my site I have them select a category (ie children, youth, adult, etc). This is done with the select list box using the content_profile module. I have a content type that posts an announcement. In this content type is a check box that says 'email group'. Right now it does nothing, but what I would like for it to do is e-mail all the users that are associated with the group they chose when signing up for their account. If this will require extra code please be specific as I am not a strong php programmer.
Thanks for the help!!
msindle
There might be some module that do it exactly, but I don't think so.
I would have done it using few building blocks:
Retrieve the list of emails using Views - define a view that gives you the addresses according to a given group argument.
Use Rules module that will send an email notification after node is created.
Combine the two (this is the hard part) - insert the values from the view as the recipients for the email. You might be able to do it using PHP inside the Rule definition, plus view execution.
Try to accomplish it, and if you get into troubles, you are welcome to contact me via shushu.i#gmail.com
I would try http://drupal.org/project/subscriptions module + http://drupal.org/project/messaging module. You can set preferences for automatic subscribing to content type. Maybe Rules module can subscribe users automatically after creating or updating content_profile. Or maybe Rules can flag users after creating or updating content_profile and Subscription module could autosubscribe flagged users.

Wordpress plug-in to instantly reply to a form?

Does anyone know if there is a wordpress plug-in which lets you set up a form which has an email field, among others.
The form, after filled in, would:
send the content of the form fields to an email address (name:joe, phone number: 555 etc)
send an instance response to the email provided ('thanks for your contribution')
add email address to an internal database (which is exportable) within the wprdpress admin
Thanks.
This will accomplish your task and more - http://wordpress.org/extend/plugins/formstack/
cformsII from Delicious Day is what you're looking for. Customizable, easy to set up, and can be set up to track all form submissions. Find it at http://www.deliciousdays.com/cforms-plugin/