InMotion Hosting Support Center

How Do I Send Mail in WordPress Without Using a Plugin?

Category: Billing

InMotionFans
n/a Points
Asked:
2014-10-30 12:48 am EST

Hits: 3,884
Hello,

I have one question which is I want a send mail without any plugin via wordpress wp-admin means admin send mail to diffrent diffrent users.. so please help me if any solution is their then.

Lots of Thank You..

You must login before you can ask a follow up question.

You must login before you can submit an answer.

OTHER ANSWERS

0

John-Paul
Staff
31,633 Points
2014-10-30 10:21 am EST
Hello,

Thank you for your question regarding sending messages from WordPress without using a plugin. While there are many plugins available to email your WordPress users, I could not find a way to accomplish this without a plugin.

This means you would have to custom code/develop a solution, as an alternate to using a plugin.

If you have any further questions, feel free to post them below.

Thank you,
John-Paul

You must login before you can post a comment about this answer.

You are write many plugins are available for email.. but I have to develop my own plugin using that plugin admin can email diffrent diffrent users.. that is my requirement ..
arpita
15 Points
2014-11-01 2:44 am EST
Here is my code.. please check

<?php /**
* Plugin Name: Email Plugin
* Plugin URI: http://your-domain.com
* Description: my WordPress plugin with full WPDK support
* Version: 1.0.0
* Author: Email
* Author URI: http://your-domain.com
*/
?>

<?php
function plugin_name_activation() {
require_once( ABSPATH . '/wp-admin/includes/upgrade.php' );
global $wpdb;
$db_table_name = $wpdb->prefix . 'prelunch_abc';
if( $wpdb->get_var( "SHOW TABLES LIKE '$db_table_name'" ) != $db_table_name ) {
if ( ! empty( $wpdb->charset ) )
$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
if ( ! empty( $wpdb->collate ) )
$charset_collate .= " COLLATE $wpdb->collate";

$sql = "CREATE TABLE " . $db_table_name . " (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`to` varchar(100) NOT NULL DEFAULT '',
`email` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
) $charset_collate;";
dbDelta( $sql );
}
}
register_activation_hook(__FILE__, 'plugin_name_activation');




function pluginUninstall()
{
global $wpdb; //required global declaration of WP variable

$table_name = $wpdb->prefix.prelunch_abc;

$sql = "DROP TABLE ". $table_name;

$wpdb->query($sql);

}
register_deactivation_hook(__('plugin') , 'pluginUninstall' );


?>

<?php

// Hook for adding admin menus
add_action('admin_menu', 'mt_add_pages');

// action function for above hook
function mt_add_pages() {
// Add a new submenu under Settings:
add_options_page(__('Test Settings','menu-test'), __('Test Settings','menu-test'), 'manage_options', 'testsettings', 'mt_settings_page');

// Add a new submenu under Tools:
add_management_page( __('Test Tools','menu-test'), __('Test Tools','menu-test'), 'manage_options', 'testtools', 'mt_tools_page');

// Add a new top-level menu (ill-advised):
add_menu_page(__('Test Toplevel','menu-test'), __('Email','menu-test'), 'manage_options', 'mt-top-level-handle', 'mt_toplevel_page' );

// Add a submenu to the custom top-level menu:
add_submenu_page('mt-top-level-handle', __('Test Sublevel','menu-test'), __('Add Email','menu-test'), 'manage_options', 'sub-page', 'mt_sublevel_page');

// Add a second submenu to the custom top-level menu:
add_submenu_page('mt-top-level-handle', __('Test Sublevel 2','menu-test'), __('View Email','menu-test'), 'manage_options', 'sub-page2', 'mt_sublevel_page2');
}

// mt_settings_page() displays the page content for the Test settings submenu
function mt_settings_page() {
echo "<h2>" . __( 'Test Settings', 'menu-test' ) . "</h2>";
}

// mt_tools_page() displays the page content for the Test Tools submenu
function mt_tools_page() {
echo "<h2>" . __( 'Test Tools', 'menu-test' ) . "</h2>";
}

// mt_toplevel_page() displays the page content for the custom Test Toplevel menu
function mt_toplevel_page() {
echo "<h2>" . __( 'Test Toplevel', 'menu-test' ) . "</h2>";
}

// mt_sublevel_page() displays the page content for the first submenu
// of the custom Test Toplevel menu
function mt_sublevel_page() {
?>
<div class="wrap">
<?
echo '<form action="' . esc_url( $_SERVER['REQUEST_URI'] ) . '" method="post">';
echo '<p>';
echo 'Your Name (required) <br />';
echo '<input type="text" name="cf-name" pattern="[a-zA-Z0-9 ]+" value="' . ( isset( $_POST["cf-name"] ) ? esc_attr( $_POST["cf-name"] ) : '' ) . '" size="40" />';
echo '</p>';
echo '<p>';
echo 'Your Email (required) <br />';
echo '<input type="email" name="cf-email" value="' . ( isset( $_POST["cf-email"] ) ? esc_attr( $_POST["cf-email"] ) : '' ) . '" size="40" />';
echo '</p>';
echo '<p>';
echo 'Subject (required) <br />';
echo '<input type="text" name="cf-subject" pattern="[a-zA-Z ]+" value="' . ( isset( $_POST["cf-subject"] ) ? esc_attr( $_POST["cf-subject"] ) : '' ) . '" size="40" />';
echo '</p>';
echo '<p>';
echo 'Your Message (required) <br />';
echo '<textarea rows="10" cols="35" name="cf-message">' . ( isset( $_POST["cf-message"] ) ? esc_attr( $_POST["cf-message"] ) : '' ) . '</textarea>';
echo '</p>';
echo '<p><input type="submit" name="cf-submitted" value="Send"/></p>';
echo '</form>'; ?>
</div>
<?php }
// mt_sublevel_page2() displays the page content for the second submenu
// of the custom Test Toplevel menu
function mt_sublevel_page2() {
echo "<h2>" . __( 'Test Sublevel2', 'menu-test' ) . "</h2>";
}


function deliver_mail() {

// if the submit button is clicked, send the email
if ( isset( $_POST['cf-submitted'] ) ) {

// sanitize form values
$name = sanitize_text_field( $_POST["cf-name"] );
$email = sanitize_email( $_POST["cf-email"] );
$subject = sanitize_text_field( $_POST["cf-subject"] );
$message = esc_textarea( $_POST["cf-message"] );

// get the blog administrator's email address
$to = get_option( 'admin_email' );

$headers = "From: $name <$email>" . "\r\n";

// If email has been process for sending, display a success message
if ( wp_mail( $to, $subject, $message, $headers ) ) {
echo '<div>';
echo '<p>Thanks for contacting me, expect a response soon.</p>';
echo '</div>';
} else {
echo 'An unexpected error occurred';
}
}
}

function cf_shortcode() {
ob_start();
deliver_mail();
html_form_code();

return ob_get_clean();
}

add_shortcode( 'sitepoint_contact_form', 'cf_shortcode' );
?>

I want send using wp-admin for admin to diffrent diffrent users.


please help me...
Thank you very much..
arpita
15 Points
2014-11-01 2:48 am EST
Hello Arpita,

Unfortunately we are not able to assist with custom coded solutions. If you are getting a specific error message we may be able to assist, but to take a look at a piece of code out of context of your environment is not something we can readily do.

Kindest Regards,
Scott M
scott
43,761 Points
Staff
2014-11-02 4:56 pm EST
Hello Scott,

You are write but when I test the code online then no any error will occurs so how i can you sending error..?
I trying more and more time but no output or error..
If you have any solution then please give me..

Thank u very much..
arpita
15 Points
2014-11-07 7:11 am EST
0

TJEdens
Staff
10,077 Points
2014-11-07 11:56 am EST
Hello Arpita,

You will need to seek out advice from other developers who create wordpress plugins. Again we are not able to assist with custom coded solutions such as your own plugin.

Kindest Regards,
TJ Edens

You must login before you can post a comment about this answer.

Ok Thank You Very much all of you who try to help me..

Next time.. :)
arpita
15 Points
2014-11-10 11:03 am EST
Like this Question?

Forum Login

You are NOT logged in. You can still browse our Support Center.

To participate within our Community Support Forum:

Need more Help?

Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail: support@InMotionHosting.com
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!