Recommended Posts

To create a new gitlab issue, I'd like to send an Email to the following email address using FormBuilder: 

incoming+account/repository@incoming.gitlab.com

unfortunately, the / in the email gets striped by the sanitizer:

wire('sanitizer')->email(incoming+account/repository@incoming.gitlab.com'); 
// output: incoming+accountrepository@incoming.gitlab.com

Is there any way to configure the sanitizer? Any other Ideas how to send the mail to this address?

 

Ps.: I can not define the email format as it is defined by gitlab. The format is also kind of "common" and known as email-alias in the form of emailaccount+alias@domain.com – gmail uses it to label mails…

https://help.wodify.com/hc/en-us/articles/234441508-How-Do-I-Create-an-Email-Alias-

Share this post


Link to post
Share on other sites

Weird. I've never seen a forward slash in an email address.

If I enter the above address in the TO field in Gmail, it's being converted to incoming@incoming.gitlab.com

https://www.jochentopf.com/email/chars.html says it's "maybe" allowed:

Quote

The forward slash is often used in email addresses used by X.400 gateways. Example: 'PN=Joe/OU=X400/@gateway.com'. Because the slash is used as a directory separator in UNIX and other operating systems, it is probably not a good idea to use it in local parts. If you ever want to save the mail in a mailbox named after the local part, you will have problems.

 

Share this post


Link to post
Share on other sites

As I said, I have no control over that part… It works in my email client and is what gitlab provides for inbound issues… The one end I can change is my implementation of PW 😉

Share this post


Link to post
Share on other sites

Sadly, gitlab has known that the forward slash is problematic for quite a while now but the resolutions keeps being pushed from milestone to milestone. There are a lot of mail servers and webmail clients out there that can't deal with these slashes (MS Exchange and Debian's exim default configurations are such examples), so any solution likely involves moving to more common delimiters in the local part of such gitlab addresses, which in turn means that PHP's built-in email sanitizing filter (which $sanitizer->email uses) will then be sufficient.

To speed things up, it might help to upvote the corresponding gitlab issue.

  • Like 1

Share this post


Link to post
Share on other sites

Any ideas on how to change the behaviour of the wire('sanitizer')->email ?

Share this post


Link to post
Share on other sites

I've just read this quickly. Maybe for now your options are:

  1. Sanitise separately: i..e, do the email itself bit then append your incoming+account/
  2. Use your own regex to sanitise the email (e.g. using $string = $sanitizer->match(string $value, string $regex);  Docs are here)
  3. Sanitise as you are doing then re-insert your / afterwards using string replace or similar.

Like I said, I read this quickly, so, I might be missing the point 🙂.

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By quickjeff
      Hi Guys, 
      I wanted to start this thread to see what others are doing to make sure they are compliant with GDPR.
      Basically, a ton of websites are built on WordPress and I am seeing tons of plugins being rolled out to help with cookie compliance etc. 
      Processwire however, doesn't have anything available. Also, if we are using FormBuilder, do we need an opt-in checkbox?
    • By ihathome
      Hi,
      I'm an abolute newbie in processwire an it's modules. But I have read huge amounts of posts in this forum and as many docs and i learnt a lot in the last days. For a contact-form i used this great module (many thanks) and i hooked it my first time. Everything is alright. Now i search for a possibility to format or render the output in the email. Is there any posibility?
      Thank you for your replies
    • By Kiwi Chris
      Forms are an essential part of most websites, and it's no surprise that there's an excellent premium module Form Builder but what if you're on a zero budget for whatever reason?
      It is possible to build forms quickly and easily by making use of a couple of free modules and the admin UI to give you a great deal of flexibility and speed of development, particularly if you need multiple forms on a website with different fields.
      1. First you're going to need to install a couple of modules:
      Form Template Processor
      Fieldtype Select External Option
      2. For each form that you want to display, create a template without a template file and add fields to it as you normally would. (eg I have formContact, formRegister etc)
      Tip: under the Advanced tab in the setup for each template, I add a tag Forms so that all my forms templates are nicely grouped together in admin.
      3. Create a new field of type Select External Option and call it formTemplate
      In the section Create options from any database table select
      templates as the source table id as the Option Value name as the Option Label 4. Create a new template file and call it renderForm.php (or whatever else you like)
      Add an email field to this form - This will be the email address that forms get submitted to. Add the formTemplate field you previously created to this form. This will allow you to select which of the templates you previously created such as formContact, formRegister etc you want to render. Add any other fields as usual that you want to render on the page. Add the following PHP code to the template file. $recipient = $page->email; $form = $modules->get('FormTemplateProcessor'); $form->template = $templates->get($page->formTemplate->label); // required $form->requiredFields = array('contactName', 'contactEmail', 'contactMesssage'); //Optional: This can be improved by having a field in the page template with a CSV list of required fields eg $form->requiredFields = explode(',', $page->requiredFields) $form->email = $recipient; // optional, sends form as email. FormTemplateProcessor can also save forms to the database. $content .= $form->render(); //generate the form to display. Note: this doesn't actually render the form at this point, but you have it in the $content variable ready to output wherever you want in your template.
      Add any template HTML or other PHP code and echo $content; wherever you want to render the form.
      5. Create a page using the renderForm template, and provide an email address, and select a form that you want to display.
      6. Use CSS to style the form as required.
      7. View your new page, and check that the form renders correctly.
      8. You can modify the templates you created at step 2 or create new ones as required if your requirements for what fields forms display changes.
      Note: The Form Template Processor module can also save form input as pages, and the FieldType Select External Option can be set up with filtering, so this solution can probably be refined further.
    • By GeekMan
      When I create a form with FormBuilder, is there a way to stop it from showing the vertical scroll bar on the right side of the form page??? For example look at this page.
      http://www.cji.edu/registration/reg-lemd/?course_name=Effective Report Writing&course_date=December 6, 2017
      Why does it even have a scroll bar?
    • By Martin Muzatko
      See gif:

      When I use $sanitizer->pageName()  to sanitize a title as name, I get a different result from what processwire automatically replaces, when editing the name in the CMS.
      I have to manually replace the dashes and even dots!
      I would expect the name to be equal to the last segment of the pagepath.