Atenção!

Este artigo contém código PHP e destina-se a desenvolvedores. Oferecemos este código como uma cortesia, mas não fornecemos suporte para personalizações de código ou desenvolvimento de terceiros.

Para orientação extra, consulte o tutorial do WPBeginner sobre como adicionar código personalizado.

Dispensar

Como Personalizar o Endereço de Email de Origem para o Addon Salvar e Continuar

Introdução

Would you like to customize the from email address that the Save and Resume addon uses when sending the resume link? Using a small snippet, you can easily customize this email to be different from your WordPress admin email. In this tutorial, we’ll walk you through how to achieve this.

Criando o formulário

First, you’ll need to create a new form. We’re using one of the many helpful templates for our form. To learn more about WPForms templates, please have a look at this documentation.

begin by creating your form

If you need assistance in creating a form, you can always review this documentation.

Enabling the Save and Resume

Next, we’ll need to enable Save and Resume on the form. To do this, click on Settings from inside the form builder and toggle the switch for Enable Save and Resume. Once you’ve enabled this, you can proceed with configuring the settings and messages. For further assistance on the Save and Resume addon and setup, please review this documentation.

enable save and resume and configure the settings

Adicionando o snippet

Now it’s time to add the snippet to your site. If you need help with how and where to add snippets to your site, check out this tutorial.

You’ll need to change the $from_address to match the email address you want to set it to. And simply by adding this snippet, any email sent with the Save and Resume addon will appear to be from [email protected].

The email settings may experience a malfunction if the SMTP plugins or custom codes are altered.

And that’s it! You’ve successfully used a snippet to customize the from email address. Would you like to also customize the reply-to email address? Check out our tutorial on How to Change the Reply-to Email for the Save and Resume Addon.

Perguntas Frequentes

Q: Can I change the name it comes from as well?

A: Absolutely! To change the name, use this snippet.

/*
* Customize the from name address that Save and Resume addon uses
* 
* @link https://wpforms.com/developers/how-to-customize-the-from-email-address-for-the-save-and-resume-addon/
*/
     
    function save_resume_change_from_name( $from_name, $email ) {
     
        if ( $email->template instanceof WPFormsSaveResume\Email\Templates\SaveResume ) {
             
            // Change from name with Save and Resume email
            $from_name = 'Sullie Eloso'; 
             
        }
         
        return $from_name;
         
    }
    add_action( 'wpforms_emails_mailer_get_from_name', 'save_resume_change_from_name', 10, 2 );

Q: Can I use this for the User Registration addon as well?

A: Absolutely! You would just use this snippet instead.

/*
 * Change the reply-to email address that the User and Registration addon uses
* 
* @link https://wpforms.com/developers/how-to-customize-the-from-email-address-for-the-save-and-resume-addon/
*/
 
function user_registration_change_reply_to( $reply_to, $email ) {
 
    if ( $email->template instanceof WPFormsUserRegistration\EmailNotifications\Templates\General ) {
         
        // Change reply-to address on User Registration email
        $reply_to = '[email protected]'; 
         
    }
 
    return $reply_to;
     
}
add_action( 'wpforms_emails_mailer_get_reply_to_address', 'user_registration_change_reply_to', 10, 2 );