How to add address mail widget in wordpress

To add an address mail widget in WordPress, you can follow these steps:

Method 1: Using a Plugin

  1. Install and activate a plugin like "Contact Form 7" or "MailChimp" which allows you to create a contact form and send emails.
  2. Go to the plugin's settings page and create a new contact form or email list.
  3. Add the address mail widget to your WordPress sidebar or footer by going to Appearance > Widgets.
  4. Drag and drop the "Contact Form 7" or "MailChimp" widget to the desired location.
  5. Configure the widget settings as needed, such as the form title, email address, and subject line.
  6. Save the changes and preview your website to test the widget.

Method 2: Using a Theme

  1. Check if your WordPress theme has a built-in contact form or address mail widget.
  2. Go to Appearance > Widgets and look for the theme's widget area.
  3. Drag and drop the contact form or address mail widget to the desired location.
  4. Configure the widget settings as needed, such as the form title, email address, and subject line.
  5. Save the changes and preview your website to test the widget.

Method 3: Using a Custom Code

  1. Create a new file in your WordPress theme's directory, e.g., address-mail-widget.php.
  2. Add the following code to the file:
    <?php
    function address_mail_widget() {
    ?>
     <form action="<?php echo get_permalink();?>" method="post">
         <label for="name">Name:</label>
         <input type="text" id="name" name="name"><br><br>
         <label for="email">Email:</label>
         <input type="email" id="email" name="email"><br><br>
         <label for="message">Message:</label>
         <textarea id="message" name="message"></textarea><br><br>
         <input type="submit" value="Send">
     </form>
     <?php
    }
    add_action('widgets_init', 'address_mail_widget');
    ?>
  3. Go to Appearance > Widgets and add the new widget to your sidebar or footer.
  4. Configure the widget settings as needed, such as the form title, email address, and subject line.
  5. Save the changes and preview your website to test the widget.

Tips and Variations