Let's say I have a content type named Order with the following fields:
Name
Product
E-mail
and the public has permission to post new entries for this type.
How can I send an email confirming the order when ever a new post request ( new entry ) is made by the public ?
You can do it using webhooks on entry.create event, integrating it with some worker or email API.
On this example, we can see a cloudflare worker for email sending:
https://dev.to/gzuidhof/sending-e-mails-from-cloudflare-workers-2abl
Here the Strapi documentation about how to deal with webhooks:
https://docs.strapi.io/developer-docs/latest/development/backend-customization/webhooks.html#entry-create
Related
Using Google Calendars API /events/insert, I create an event in a user's calendar on their behalf and set them as the organizer. I also invite one guest.
I want the organizer to receive an email notification similar to what a guest might receive. I tried using the sendUpdates parameter but it only notifies guests.
Is there a way to notify the organizer that an event was created in their calendar on their behalf?
That is outside of what even Google Calendar can do. So this problem is unrelated to the API itself. Google calendar assumes that the organizer is the one creating the event so already knows it is being created so there is no reason to notify them.
You have access via Oauth2, there is no way the api knows that this is not the user themselves as your application has permission to preform actions on behalf of the user. So google calendar thinks you are the user so no reason to notify you.
Here's a work around I have used in the past.
As you already have write access on the calendar you should have access to see who the owner is by doing an acl.list this will get you their email address.
You could then have your application email them.
You can also invite them using an allies email address, however i have found some clients don't like this solution as they then appear twice.
One work around you can do is to add a another version of the owners email to the attendees. For example, if their normal email is test#gmail.com you can convert it to test+1#gmail.com. They'll receive an invite at their normal email. Keep in mind this will add an additional attendee to the event. When they click accept in the email it will mark their original email as accepted, not the one with +1 appended to it.
See this basic function for adding a +1 the email in JS:
function changeEmail(email) {
let splitEmail = email.split('#');
return splitEmail[0] + '+1#' + splitEmail[1];
}
Note you can add any text after the email. It doesn't have to be +1.
Answer:
As DaImTo has said, the API will not provide an email to the user who has created the event, which is exactly what your application is doing via OAuth2.
You can however take the event information from the response and manually send the user an Email using the Gmail API.
Example Code:
I do not know what language you are using, but as a python example, after getting the Gmail service with your service account credentials:
subject = "email#example.com"
delegated_credentials = service_account.Credentials.from_service_account_file(key_file_location, scopes=scopes, subject=subject)
gmail_service = discovery.build(api_name, api_version, credentials=delegated_credentials)
You can use the Sending Email tutorial to create and send an email on behalf of the user that created the event:
# Copyright 2020 Google LLC.
# SPDX-License-Identifier: Apache-2.0
def create_message(sender, to, subject, message_text):
message = MIMEText(message_text)
message['to'] = to
message['from'] = sender
message['subject'] = subject
return {'raw': base64.urlsafe_b64encode(message.as_string())}
def send_message(service, user_id, message):
try:
message = (service.users().messages().send(userId=user_id, body=message)
.execute())
print 'Message Id: %s' % message['id']
return message
except errors.HttpError, error:
print 'An error occurred: %s' % error
And then simply send the information to the user via email using the data already defined for the event insert call:
emailText = "Title: " + summary + "\nStart: " + startTime + "\nEnd: " + endTime
msg = create_message(subject, # the sub for the service account
subject, #to and from are the same
"A Calendar Event has been created on your behalf",
emailText)
send_message(gmail_service, calendar_response['creator']['email']
References:
Sending Email | Gmail API | Google Developers
I need to send a mail along with category by using Graph or Rest API, If that category is not exist for the receiver then it should create and mail should be tagged with created category, any way to achieve this task with graph or rest API?
When e-mail is marked with certain category which doesn't exist in the recipient's mailbox, this category will not and cannot be created automatically just by receiving this message.
I'm creating custom emails (many customizations) in MailChimp campaign builder. Looks like the only option to send is via a campaign, which I'd need to manually upload a list of email addresses. I honestly just want to use the builder to send a quality form email, that I customize for each recipient.
Is it possible to send an email to a specific email address without building a list, etc? This will probably be a one-time thing.
You can send campaign to single email address in mailchimp through this method. However you can't send the same campaign more than once to same email address.
create an automation email with API 3.0 as trigger.
Now, to send a campaign, make POST call to the given url with email address in your mailchimp
https://us19.api.mailchimp.com/3.0/automations/********/emails/********/queue
Now, To call that api you need to add HTTP BAsic Auth or OAuth 2 to API Request. See this answer MailChimp 3.0 HTTP POST Json Example
There's also a npm module to make life easier https://npmjs.com/package/mailchimp-api-v3
This is just a workaround as mailchimp was not built for single emails. In the longer run I'd suggest you to look into mandrill, sendgrid or other transactional email tool.
You are better off using Mandrill, MailChimp's transactional email app, to send one off emails. You can still use or at least make use of MailChimp campaigns but you can send one off emails that are customised and you do not need to send to a list
I have a laravel application,
I send notifications to a user when he registers. I use the notify() on the model. But I have an issue, How do i send a notification to a custom email address? the same notification.
Here's what i have:
`$admin = Admin::find(1);
$admin->email = 'admin#site.com';
$admin->notify((new NewUserRegistered($user))->delay($when));
$user->notify((new UserRegistered($user))->delay($when));`
i get a user model instance, and customize the email to input the custom email... However, the email sends to the original mail on the model and ignores the edit.
How do i do this please?
Here the code snippet you can use for sending the notification directly to an email address without creating the User or without having the User in the database.
Notification::route('mail', 'me#abdulrehman.pk')->notify(new InvoicePaid($invoice));
As a work around, you can save the model before sending the message
$admin->email = 'admin#site.com';
$admin->save();
after that you can retrieve the email as it was
I'm trying to configure email in my magento website. My website is https://tumree.com. I just enabled contacts in system->configuration.
Send Emails To : admin#tumree.com and Email Sender: Custom Email 2.
In store email adress, In Custom email 2, sender name: Tumree admin and sender email:admin#tumree.com
When I'm trying to fill out the forms and submit, the msg "Form is submitted successfully". The account admin#tumree.com receives the email with customer name,email,number,comment.
But the customer who is filled out the form with name,email etc., not receiving the mail.
I enabled in the mail settings for return-path-> yes. But I dint reflect anything. when the order is placed, the customer not receiving the mail too with order details. Pls help me here....enter link description here
To send emails out of your server, you probably need to do it with smtp . Your server sends emails ("Form is submitted successfully")but they are rejected from the target server. Try it with https://www.magentocommerce.com/magento-connect/smtp-pro-email-free-custom-smtp-email.html or something related.