if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { $newlang = $object->thirdparty->default_lang; } if (!empty($newlang)) { $outputlangs = new Translate('', $conf); $outputlangs->setDefaultLang($newlang); $outputlangs->load('bills'); } // Build document if it not exists if (!$file || !is_readable($file)) { $result = $object->generateDocument(GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result <= 0) { dol_print_error($db, $object->error, $object->errors); exit; } $fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/') . '[^\\-]+'); $file = $fileparams['fullname']; } print '<div class="clearboth"></div>'; print '<br>'; print load_fiche_titre($langs->trans($titreform)); // Cree l'objet formulaire mail dol_fiche_head(); include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; $formmail = new FormMail($db); $formmail->param['langsmodels'] = empty($newlang) ? $langs->defaultlang : $newlang; $formmail->fromtype = 'user'; $formmail->fromid = $user->id; $formmail->fromname = $user->getFullName($langs); $formmail->frommail = $user->email; if (!empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && $conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1) {
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { $newlang = $object->client->default_lang; } if (!empty($newlang)) { $outputlangs = new Translate('', $conf); $outputlangs->setDefaultLang($newlang); $outputlangs->load('bills'); } // Build document if it not exists if (!$file || !is_readable($file)) { $result = $object->generateDocument(GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result <= 0) { dol_print_error($db, $object->error, $object->errors); exit; } $fileparams = dol_most_recent_file($conf->fournisseur->facture->dir_output . '/' . get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier') . $ref, preg_quote($ref, '/') . '([^\\-])+'); $file = $fileparams['fullname']; } print '<div class="clearboth"></div>'; print '<br>'; print load_fiche_titre($langs->trans('SendBillByMail')); dol_fiche_head(''); // Cree l'objet formulaire mail include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; $formmail = new FormMail($db); $formmail->param['langsmodels'] = empty($newlang) ? $langs->defaultlang : $newlang; $formmail->fromtype = 'user'; $formmail->fromid = $user->id; $formmail->fromname = $user->getFullName($langs); $formmail->frommail = $user->email; if (!empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && $conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1) {
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { $newlang = $object->client->default_lang; } if (!empty($newlang)) { $outputlangs = new Translate('', $conf); $outputlangs->setDefaultLang($newlang); $outputlangs->load('sendings'); } // Build document if it not exists if (!$file || !is_readable($file)) { $result = $object->generateDocument(GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result <= 0) { dol_print_error($db, $object->error, $object->errors); exit; } $fileparams = dol_most_recent_file($conf->expedition->dir_output . '/sending/' . $ref, preg_quote($ref, '/') . '[^\\-]+'); $file = $fileparams['fullname']; } print '<div class="clearboth"></div>'; print '<br>'; print load_fiche_titre($langs->trans('SendShippingByEMail')); dol_fiche_head(''); // Cree l'objet formulaire mail include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; $formmail = new FormMail($db); $formmail->param['langsmodels'] = empty($newlang) ? $langs->defaultlang : $newlang; $formmail->fromtype = 'user'; $formmail->fromid = $user->id; $formmail->fromname = $user->getFullName($langs); $formmail->frommail = $user->email; if (!empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && $conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1) {
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && !empty($_REQUEST['lang_id'])) { $newlang = $_REQUEST['lang_id']; } if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { $newlang = $object->client->default_lang; } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); } $result = propale_pdf_create($db, $object, GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result <= 0) { dol_print_error($db, $result); exit; } $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref, '/')); $file = $fileparams['fullname']; } print '<br>'; print_titre($langs->trans('SendPropalByMail')); // Create form object include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; $formmail = new FormMail($db); $formmail->fromtype = 'user'; $formmail->fromid = $user->id; $formmail->fromname = $user->getFullName($langs); $formmail->frommail = $user->email; $formmail->withfrom = 1; $liste = array(); foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value) { $liste[$key] = $value;
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && !empty($_REQUEST['lang_id'])) { $newlang = $_REQUEST['lang_id']; } if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { $newlang = $object->client->default_lang; } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); } $result = supplier_order_pdf_create($db, $object, GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result <= 0) { dol_print_error($db, $result); exit; } $fileparams = dol_most_recent_file($conf->fournisseur->commande->dir_output . '/' . $ref, preg_quote($ref, '/')); $file = $fileparams['fullname']; } print '<br>'; print_titre($langs->trans('SendOrderByMail')); // Cree l'objet formulaire mail include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; $formmail = new FormMail($db); $formmail->fromtype = 'user'; $formmail->fromid = $user->id; $formmail->fromname = $user->getFullName($langs); $formmail->frommail = $user->email; $formmail->withfrom = 1; $liste = array(); foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value) { $liste[$key] = $value;
/** * * @param unknown $object */ static function sendOrderByMail(&$object) { global $conf, $langs, $user, $db; if (empty($object->thirdparty)) { $object->fetch_thirdparty(); } $sendto = $object->thirdparty->email; $sendtocc = ''; $from = empty($user->email) ? $conf->global->MAIN_MAIL_EMAIL_FROM : $user->email; $id = $object->id; $_POST['receiver'] = '-1'; $_POST['frommail'] = $_POST['replytomail'] = $from; $_POST['fromname'] = $_POST['replytoname'] = $user->getFullName($langs); dol_include_once('/core/class/html.formmail.class.php'); $formmail = new Formmail($db); $outputlangs = clone $langs; $id_template = (int) $conf->global->GRAPEFRUIT_SEND_BILL_BY_MAIL_ON_VALIDATE_MODEL; $formmail->fetchAllEMailTemplate('facture_send', $user, $outputlangs); foreach ($formmail->lines_model as &$model) { if ($model->id == $id_template) { break; } } if (empty($model)) { setEventMessage($langs->trans('ModelRequire'), 'errors'); } // Make substitution $substit['__REF__'] = $object->ref; $substit['__SIGNATURE__'] = $user->signature; $substit['__REFCLIENT__'] = $object->ref_client; $substit['__THIRDPARTY_NAME__'] = $object->thirdparty->name; $substit['__PROJECT_REF__'] = is_object($object->projet) ? $object->projet->ref : ''; $substit['__PROJECT_NAME__'] = is_object($object->projet) ? $object->projet->title : ''; $substit['__PERSONALIZED__'] = ''; $substit['__CONTACTCIVNAME__'] = ''; // Find the good contact adress $custcontact = ''; $contactarr = array(); $contactarr = $object->liste_contact(-1, 'external'); if (is_array($contactarr) && count($contactarr) > 0) { foreach ($contactarr as $contact) { dol_syslog(get_class($this) . '::' . __METHOD__ . ' lib=' . $contact['libelle']); dol_syslog(get_class($this) . '::' . __METHOD__ . ' trans=' . $langs->trans('TypeContact_commande_external_BILLING')); if ($contact['libelle'] == $langs->trans('TypeContact_commande_external_BILLING')) { require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; $contactstatic = new Contact($db); $contactstatic->fetch($contact['id']); $custcontact = $contactstatic->getFullName($langs, 1); dol_syslog(get_class($this) . '::' . __METHOD__ . ' email=' . $contactstatic->email); } } if (!empty($custcontact)) { $substit['__CONTACTCIVNAME__'] = $custcontact; } if (!empty($contactstatic->email)) { $sendto = $contactstatic->email; } } $topic = make_substitutions($model->topic, $substit); $message = make_substitutions($model->content, $substit); $_POST['message'] = $message; $_POST['subject'] = $topic; require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; // Add attached files $fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $object->ref, preg_quote($object->ref, '/') . '[^\\-]+'); if (is_array($fileparams) && array_key_exists('fullname', $fileparams) && !empty($fileparams['fullname'])) { $_SESSION["listofpaths"] = $fileparams['fullname']; $_SESSION["listofnames"] = basename($fileparams['fullname']); $_SESSION["listofmimes"] = dol_mimetype($fileparams['fullname']); } else { // generate invoice $result = $object->generateDocument($object->modelpdf, $outputlangs, 0, 0, 0); if ($result <= 0) { $this->error = $object->error; } $fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $object->ref, preg_quote($object->ref, '/') . '[^\\-]+'); if (is_array($fileparams) && array_key_exists('fullname', $fileparams) && !empty($fileparams['fullname'])) { $_SESSION["listofpaths"] = $fileparams['fullname']; $_SESSION["listofnames"] = basename($fileparams['fullname']); $_SESSION["listofmimes"] = dol_mimetype($fileparams['fullname']); } } $action = 'send'; $actiontypecode = 'AC_FAC'; $trigger_name = 'BILL_SENTBYMAIL'; $paramname = 'id'; $mode = 'emailfrominvoice'; if (!empty($sendto)) { require_once __DIR__ . '/../tpl/actions_sendmails.inc.php'; } }
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && !empty($_REQUEST['lang_id'])) { $newlang = $_REQUEST['lang_id']; } if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { $newlang = $object->client->default_lang; } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); } $result = fichinter_create($db, $object, GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result <= 0) { dol_print_error($db, $result); exit; } $fileparams = dol_most_recent_file($conf->ficheinter->dir_output . '/' . $ref, preg_quote($ref, '/')); $file = $fileparams['fullname']; } print '<br>'; print_titre($langs->trans('SendInterventionByMail')); // Create form object include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; $formmail = new FormMail($db); $formmail->fromtype = 'user'; $formmail->fromid = $user->id; $formmail->fromname = $user->getFullName($langs); $formmail->frommail = $user->email; $formmail->withfrom = 1; $liste = array(); foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value) { $liste[$key] = $value;
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && !empty($_REQUEST['lang_id'])) { $newlang = $_REQUEST['lang_id']; } if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { $newlang = $object->client->default_lang; } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); } $result = facture_pdf_create($db, $object, GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); if ($result <= 0) { dol_print_error($db, $result); exit; } $fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref); $file = $fileparams['fullname']; } print '<br>'; print_titre($langs->trans($titreform)); // Cree l'objet formulaire mail include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; $formmail = new FormMail($db); $formmail->fromtype = 'user'; $formmail->fromid = $user->id; $formmail->fromname = $user->getFullName($langs); $formmail->frommail = $user->email; $formmail->withfrom = 1; $formmail->withto = empty($_POST["sendto"]) ? 1 : $_POST["sendto"]; $formmail->withtosocid = $soc->id; $formmail->withtocc = 1;
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && !empty($_REQUEST['lang_id'])) { $newlang = $_REQUEST['lang_id']; } if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { $newlang = $object->client->default_lang; } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); } $result = supplier_order_pdf_create($db, $object, GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); if ($result <= 0) { dol_print_error($db, $result); exit; } $fileparams = dol_most_recent_file($conf->fournisseur->commande->dir_output . '/' . $ref); $file = $fileparams['fullname']; } print '<br>'; print_titre($langs->trans('SendOrderByMail')); // Cree l'objet formulaire mail include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; $formmail = new FormMail($db); $formmail->fromtype = 'user'; $formmail->fromid = $user->id; $formmail->fromname = $user->getFullName($langs); $formmail->frommail = $user->email; $formmail->withfrom = 1; $formmail->withto = empty($_POST["sendto"]) ? 1 : $_POST["sendto"]; $formmail->withtosocid = $soc->id; $formmail->withtocc = 1;
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && !empty($_REQUEST['lang_id'])) { $newlang = $_REQUEST['lang_id']; } if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { $newlang = $object->client->default_lang; } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); } $result = fichinter_create($db, $object, GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); if ($result <= 0) { dol_print_error($db, $result); exit; } $fileparams = dol_most_recent_file($conf->ficheinter->dir_output . '/' . $ref); $file = $fileparams['fullname']; } print '<br>'; print_titre($langs->trans('SendInterventionByMail')); // Create form object include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; $formmail = new FormMail($db); $formmail->fromtype = 'user'; $formmail->fromid = $user->id; $formmail->fromname = $user->getFullName($langs); $formmail->frommail = $user->email; $formmail->withfrom = 1; $formmail->withto = !GETPOST('sendto', 'alpha') ? 1 : GETPOST('sendto', 'alpha'); $formmail->withtosocid = $societe->id; $formmail->withtocc = 1;
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && !empty($_REQUEST['lang_id'])) { $newlang = $_REQUEST['lang_id']; } if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { $newlang = $object->client->default_lang; } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); } $result = supplier_invoice_pdf_create($db, $object, GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result <= 0) { dol_print_error($db, $result); exit; } $fileparams = dol_most_recent_file($conf->fournisseur->facture->dir_output . '/' . get_exdir($object->id, 2) . $ref, preg_quote($ref, '/')); $file = $fileparams['fullname']; } print '<br>'; print_titre($langs->trans('SendBillByMail')); // Cree l'objet formulaire mail include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; $formmail = new FormMail($db); $formmail->fromtype = 'user'; $formmail->fromid = $user->id; $formmail->fromname = $user->getFullName($langs); $formmail->frommail = $user->email; $formmail->withfrom = 1; $liste = array(); foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value) { $liste[$key] = $value;
function _sendByMail(&$db, &$conf, &$user, &$langs, &$facture, &$societe, $label) { $filename_list = array(); $mimetype_list = array(); $mimefilename_list = array(); $ref = dol_sanitizeFileName($facture->ref); $fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/') . '([^\\-])+'); $file = $fileparams['fullname']; // Build document if it not exists if (!$file || !is_readable($file)) { $result = $facture->generateDocument($facture->modelpdf, $langs, 0, 0, 0); if ($result <= 0) { $error = 1; return $error; } } $label = !empty($conf->global->SENDINVOICETOADHERENT_SUBJECT) ? $conf->global->SENDINVOICETOADHERENT_SUBJECT : $label; $substitutionarray = array('__NAME__' => $societe->name, '__REF__' => $facture->ref); $message = $conf->global->SENDINVOICETOADHERENT_MESSAGE; $message = make_substitutions($message, $substitutionarray); $fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/') . '([^\\-])+'); $file = $fileparams['fullname']; $filename = basename($file); $mimefile = dol_mimetype($file); $filename_list[] = $file; $mimetype_list[] = $mimefile; $mimefilename_list[] = $filename; $CMail = new CMailFile($label, $societe->email, $conf->global->MAIN_MAIL_EMAIL_FROM, $message, $filename_list, $mimetype_list, $mimefilename_list, '', '', '', '', $errors_to = $conf->global->MAIN_MAIL_ERRORS_TO); // Send mail return $CMail->sendfile(); }
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { $newlang = $object->thirdparty->default_lang; } if (!empty($newlang)) { $outputlangs = new Translate('', $conf); $outputlangs->setDefaultLang($newlang); $outputlangs->load('commercial'); } // Build document if it not exists if (!$file || !is_readable($file)) { $result = $object->generateDocument(GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result <= 0) { dol_print_error($db, $object->error, $object->errors); exit; } $fileparams = dol_most_recent_file($conf->askpricesupplier->dir_output . '/' . $ref, preg_quote($ref, '/') . '[^\\-]+'); $file = $fileparams['fullname']; } print '<div class="clearboth"></div>'; print '<br>'; print_fiche_titre($langs->trans('SendAskByMail')); dol_fiche_head(''); // Create form object include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; $formmail = new FormMail($db); $formmail->param['langsmodels'] = empty($newlang) ? $langs->defaultlang : $newlang; $formmail->fromtype = 'user'; $formmail->fromid = $user->id; $formmail->fromname = $user->getFullName($langs); $formmail->frommail = $user->email; $formmail->withfrom = 1;
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && !empty($_REQUEST['lang_id'])) { $newlang = $_REQUEST['lang_id']; } if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { $newlang = $object->client->default_lang; } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); } $result = propale_pdf_create($db, $object, GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); if ($result <= 0) { dol_print_error($db, $result); exit; } $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref); $file = $fileparams['fullname']; } print '<br>'; print_titre($langs->trans('SendPropalByMail')); // Create form object include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; $formmail = new FormMail($db); $formmail->fromtype = 'user'; $formmail->fromid = $user->id; $formmail->fromname = $user->getFullName($langs); $formmail->frommail = $user->email; $formmail->withfrom = 1; $formmail->withto = empty($_POST["sendto"]) ? 1 : $_POST["sendto"]; $formmail->withtosocid = $soc->id; $formmail->withtocc = 1;
if (!empty($newlang)) { $outputlangs = new Translate('', $conf); $outputlangs->setDefaultLang($newlang); $outputlangs->load('commercial'); } // Build document if it not exists if (! $file || ! is_readable($file)) { $result = $object->generateDocument(GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result <= 0) { dol_print_error($db, $object->error, $object->errors); exit(); } $fileparams = dol_most_recent_file($conf->supplier_proposal->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+'); $file = $fileparams['fullname']; } print '<div class="clearboth"></div>'; print '<br>'; print load_fiche_titre($langs->trans('SendAskByMail')); dol_fiche_head(''); // Create form object include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; $formmail = new FormMail($db); $formmail->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang); $formmail->fromtype = 'user'; $formmail->fromid = $user->id;
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && !empty($_REQUEST['lang_id'])) { $newlang = $_REQUEST['lang_id']; } if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { $newlang = $object->client->default_lang; } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); } $result = expedition_pdf_create($db, $object, GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); if ($result <= 0) { dol_print_error($db, $result); exit; } $fileparams = dol_most_recent_file($conf->expedition->dir_output . '/sending/' . $ref); $file = $fileparams['fullname']; } print '<br>'; print_titre($langs->trans('SendShippingByEMail')); // Cree l'objet formulaire mail include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; $formmail = new FormMail($db); $formmail->fromtype = 'user'; $formmail->fromid = $user->id; $formmail->fromname = $user->getFullName($langs); $formmail->frommail = $user->email; $formmail->withfrom = 1; $formmail->withto = GETPOST('sendto', 'int') ? GETPOST('sendto', 'int') : 1; $formmail->withtosocid = $soc->id; $formmail->withtocc = 1;