1

Dear members,

Hope you all are in the state of prosperity and well being.

I have my contact us at the site. It has following fields:

Name:
Email Address:
Subject:
Message

....and a submit button. It works properly.

Since i have created this to assist the site members to ask their problem with the site administrator. But i want the email to be dispatched to the selected admins or to all the admin's email address.

Secondly i want to give the ability to the members to attach the files also in the message if they want within a size limit of 10 MB etc and if they attach then the file must be emailed to the admin's email addresses.

In a nutshell, if someone tries to contact our site admins then the message along with the file he leaves & uploads through contact us page must be delivered to all the admin's email address or the selected admin's email address.


Kindly tell me how could i accomplish it. I am using social engine as my site core infrastructure.

Regards,

Zohdi Rizvi

Attachments
<?php

/* $Id: help_contact.php 42 2009-01-29 04:55:14Z john $ */

$page = "help_contact";
include "header.php";

if(isset($_POST['task'])) { $task = $_POST['task']; } elseif(isset($_GET['task'])) { $task = $_GET['task']; } else { $task = "main"; }


// SET DEFAULTS
$result = 0;
$is_error = 0;

// SET DEFAULT EMAIL IF NOT SUBMITTED
if(!isset($_POST['contact_email'])) { $contact_email = $user->user_info['user_email']; } else { $contact_email = $_POST['contact_email']; }

// SEND HELP MESSAGE
if($task == "dosend")
{
  $contact_name = $_POST['contact_name'];
  $contact_subject = $_POST['contact_subject'];
  $contact_message = $_POST['contact_message'];

  // MAKE SURE FIELDS ARE NOT BLANK
  if(!is_email_address($contact_email)) { $is_error = 698; }
  if(trim($contact_message) == "") { $is_error = 1036; }
  if(trim($contact_name) == "") { $is_error = 1046; }
  
  // CHECK CODE
  // NOW IN HEADER:
  //session_start();
  if( !empty($setting['setting_contact_code']) )
  {
    $code = $_SESSION['code'];
    if($code == "") { $code = randomcode(); }
    $contact_secure = $_POST['contact_secure'];
    
    if($contact_secure != $code)
      $is_error = 708;
  }
  
  // SEND MESSAGE TO SUPERADMIN
  if( !$is_error )
  {
    $recepient_info = $database->database_fetch_assoc($database->database_query("SELECT admin_email, admin_name FROM se_admins ORDER BY admin_id LIMIT 1"));

    // GET SUBJECT AND MESSAGE
    SE_Language::_preload_multi(1153, 1154);
    SE_Language::load();

    // COMPOSE SUBJECT
    $subject = vsprintf(SE_Language::_get(1153), Array($contact_subject));

    // COMPOSE MESSAGE
    $message = vsprintf(SE_Language::_get(1154), Array($recepient_info['admin_name'], $contact_email, $contact_name, $contact_subject, $contact_message));

    // SEND MAIL
    send_generic($recepient_info['admin_email'], $contact_email, $subject, $message, Array(), Array());

    // SET RESULT
    $result = 1040;
    $contact_name = "";
    $contact_email = $user->user_info['user_email'];
    $contact_subject = "";
    $contact_message = "";
  }

}

// SET GLOBAL PAGE TITLE/DESCRIPTION
$global_page_title[0] = 754;
$global_page_description[0] = 1035;

// ASSIGN SMARTY VARIABLES AND INCLUDE FOOTER
$smarty->assign('result', $result);
$smarty->assign('is_error', $is_error);
$smarty->assign('contact_name', $contact_name);
$smarty->assign('contact_email', $contact_email);
$smarty->assign('contact_subject', $contact_subject);
$smarty->assign('contact_message', $contact_message);
include "footer.php";
?>
4
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by diafol
0

You very well know what you want to have in your website and you have done everything perfectly too.
So what exactly expect from us.
If you expect the suggestions to improve the exsting script ,
think about putting some select element for the user to select the email ids of respective admins with their designations to send the mails.

0

Yeah, why don't you just have a generic 'you have been sent a problem post' email or something? All the data is stored in the db and available to display via a link in the email.
Depending on the no. of admins, you could use the simple 'mail()' function, although it's not brilliant.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.