How to send Email from blogger?

Good evening everyone,

I’m tying to send email from blogger with my subdomain But I got this error

“Access to XMLHttpRequest at from origin ‘ domain’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.”

Is there any solutions?

Try to do one of the following steps :

  1. Set up a custom subdomain: Ensure that you have configured a custom subdomain for your Blogger blog through your domain registrar. This typically involves creating a record that points your subdomain to your Blogger blog.
  2. Verify ownership of the domain: In your Blogger settings, verify that you own the custom subdomain by adding the necessary DNS records provided by Blogger. This step confirms that you have control over the domain.

Thanks David for your reply

at the 1st point all I did is:

I added the subdomain at blogger settings then I added the CNME record with Name blogs with content ghs and proxied

at the 2nd point :

How to find them? or I didn’t get what you mean?

The issue @sascompany2024 is explained in the error message

This means the browser is blocking the request. You need to add the Access-Control-Allow-Origin to the requested resource.

This has nothing to do with CNAME or domain verification as suggested by @davidhilbert010.

1 Like

Thanks for your reply @anon9246926 but can you provide me more helpful because I’m beginner
that’s my script that I using to send email

where should i put the Access-Control-Allow-Origin

That's the code I used 

const nameField = document.querySelector("#content-blanter #ContactForm1_contact-form-name");
const emailField = document.querySelector("#content-blanter #ContactForm1_contact-form-email");
const messageField = document.querySelector("#content-blanter #ContactForm1_contact-form-email-message");
const sendBtn = document.querySelector("#content-blanter #ContactForm1_contact-form-submit");
const errorMessage = document.querySelector(
  "#content-blanter #ContactForm1_contact-form-error-message");
const successMessage = document.querySelector(
  "#content-blanter #ContactForm1_contact-form-success-message");

const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;

sendBtn.addEventListener("click", (e) => {
  if (
    nameField.value.trim() === "" ||
    emailField.value.trim() === "" ||
    messageField.value.trim() === ""
  ) {
    errorMessage.textContent = "All fields are necessary";
  } else if (!emailRegex.test(emailField.value)) {
    errorMessage.textContent = "Please enter a valid email";
  } else {
    errorMessage.textContent = "";
      var templateParams = {
        from_name: nameField,
        email_id: emailField,
        message: messageField
    function sendEmail() {
          Host : "",
          Username : "username",
          Password : "pass",
          To : 'to',
          From : templateParams.email_id,
          Subject : templateParams.from_name,
          Body : templateParams.message
          message => alert(message)

nameField.addEventListener("focus", () => {
  errorMessage.textContent = "";

emailField.addEventListener("focus", () => {
  errorMessage.textContent = "";

messageField.addEventListener("focus", () => {
  errorMessage.textContent = "";


The header is required in the endpoint (e.g. server.) It is not something set in front end code.

Speaking of front end end code, if the above snippet is what is used on the front end of your site, then anyone and everyone has access to the username and password for your email.

1 Like