Mails not sending on October CMS

Hi!

The mails won’t be able to send from the site, so no one cant make a pre-order or something like that.

In version 2x, I was using this manual to get it working. On the 3x versions this one not working
https://blocs2-help.blocsapp.com/using-contact-forms-with-october-cms/

$(function()
{	
	$('[data-form-type="blocs-form"] input,[data-form-type="blocs-form"] textarea').jqBootstrapValidation(
    {
     	preventSubmit: true,
     	submitSuccess: function($form, event)
	 	{			
			if(!$form.attr('action')) // Check form doesnt have action attribute
			{
				event.preventDefault(); // prevent default submit behaviour
			
				var processorFile = getProcessorPath($form);
				var formData = {};

				$form.find("input, textarea, option:selected").each(function(e) // Loop over form objects build data object
				{		
					var fieldData =  $(this).val();
					var fieldID =  $(this).attr('id');
				
					if($(this).is(':checkbox')) // Handle Checkboxes
					{
						fieldData = $(this).is(":checked");
					}
					else if($(this).is(':radio')) // Handle Radios
					{
						fieldData = $(this).val()+' = '+$(this).is(":checked");
					}
					else if($(this).is('option:selected')) // Handle Option Selects
					{
						fieldID = $(this).parent().attr('id');
					}
					
					formData[fieldID] = fieldData;		
				});
	
				$.ajax({
		        	url: processorFile,
		    		type: "POST",
		    		data: formData,
		    		cache: false,
		    		success: function() // Success
		 			{  
						if($form.is('[data-success-msg]')) // Show Success Message
						{
							$form.append("<div id='form-alert' class=\"mt-2\"><div class='alert alert-success'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button><strong>"+$form.attr('data-success-msg')+"</strong></div></div>");
						}
						else // Re-Direct
						{
							window.location.replace($form.attr('data-success-url'));
						}	
						
						$form.trigger("reset"); // Clear Form	
		 	   		},
			   		error: function() // Fail
			   		{
						if($('#form-alert').length == 0)
						{
							$form.append("<div id='form-alert' class=\"mt-2\"><div class='alert alert-danger'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button><strong>"+$form.attr('data-fail-msg')+"</strong></div></div>");
						}	
			   		},
		   		});
			}
         },
         filter: function() // Handle hidden form elements
		 {
			 return $(this).is(":visible");
         },
	 });
	 
	 // Get Path to processor PHP file
	 function getProcessorPath(form)
	 {
		var path = "./includes/"+form.attr('id')+".php";
		
		if (form.attr('data-clean-url-used')) // Clean URL use Double Dot
		{
			path = "."+path;
		}
		else if (form.attr('template-path')) // Check For Template path
		{
			path = form.attr('template-path')+"/includes/"+form.attr('id')+".php";
		}
		
	 	return path
	 }
});

So what i need to edit to make mail agent working?

Very few here have any direct knowledge of using October, so you might have more luck with October forums. The only one here using it regularly that I know of is @PeteSharp

1 Like

Its probably something Norm should be aware of and look into given …

In case something may have changed within Blocs or if something infact needs changed within Blocs due possible changes within October CMS itself. It seems like if it was working in the previous version in accordance to the Blocs documentation, then something has changed that will need addressed.

2 Likes

As @Blocs_User says above.

There could be a number of reasons, I assume you are getting a success message on the website once you send the form?

Also I would be looking at the docs for Blocs 3 not 2. It appears this is unchanged in this case though.

https://help.blocsapp.com/knowledge-base/october-cms-forms/

1 Like

Forms sending with HTML export, so the problem is in access to form includes.

The link you added have the same content as for blocs 2x, but the 3x version have different FormHandler

Another weird THING is when I first time export to October CMS, the project is lost ability to html export

The way I am exporting to CMS
Screen Shot 2020-10-09 at 22.51.01

That “broken” structure looks like Clean URL is selected.

I have never used the Blocs form in an OctoberCMS website. I use a custom plugin usually.

1 Like

Interesting! But what for this option needed?

So almost figure out what was the problem. I made a copy of project with October cms config option and remade all forms and now they working although customs form handler as in version 2x, by deleting IF, ELSE and working but not stable

You’re saying you need to modify the conditions of the formHandler.js that Blocs outputs? That seems a bit much and probably needs looked at regarding what may have changed in Blocs 3 or October CMS. Because aside from the path / includes you should not need to modify conditionals also, unless I misunderstood your statement.

Thanks for your reply.

Partially I fixed it. But here is the strange thing: includes from the theme folder won’t work even after editing of “formHandler.js”. If I opening a direct link to “form.js” in the web browser, October cams show me a 404 page.

You’re welcome.

But I guess the initial response you received in this thread was good advice considering.

Sorry if you’ve yet to get a response from the developer of Blocs, but maybe you will indeed have success with the October CMS developers. Let us know what is determined should you hear back from someone directly regarding either side of the equation.