Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Cover email in form mail

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty Development
View previous topic :: View next topic  
Author Message
prova17
Smarty Rookie


Joined: 24 May 2010
Posts: 6

PostPosted: Sat Jun 12, 2010 3:53 pm    Post subject: Cover email in form mail Reply with quote

Hi everybody,
I have a problem. I have a form mail where users can write without know the email of the other user.

When I see the source of the webpage (from the browser) I can see the email address of the user that could be private.

How can I cover the email address of the user???

Thaks in advance Confused

Code:
<form id="em" action="java-script:void(null);">
         {if $user->get('gid') != 0}
         <table cellpadding="5" cellspacing="0" border="0" width="100%" id="jetablelatest">
         <tr>
            <td  align="left">
            <p><label for="Price">{JText text="JE_EMAILFORM_FROM"}</label> <input type="text" name="name" size="30" value="{$user->username}"></p>
            <p><label for="Price">{JText text="JE_EMAILFORM_EMAIL"}</label> <input type="text" name="from" size="30" value="{$user->email}"></p>
            <p><label for="Price">{JText text="JE_EMAILFORM_PHONE"}</label> <input type="text" name="phone" size="30"></p>
                        
            <p><label for="Price">REF Number</label> <input type="text" name="ref_oggetto" size="30" class="required" value="es. REF123456789"></p>
            <p><label for="Price">{JText text="JE_EMAILFORM_MESSAGE"}</label><textarea name="body" cols="25" rows="7"></textarea></p>

            <p><input type="button" value="{JText text='JE_EMAILFORM_SENT'}" class="submit" onClick="xajax_JomestateController.sendemail(xajax.getFormValues('em'));"></p>
            <input type="hidden" name="subject" value="{$item->ad_ref} - {JText text='JE_EMAILFORM_SUBJECT'}">
            <input type="hidden" name="to" value="{$user_fromid->email}" size="30">
            <p><div id="email"></div></p>
            </td>
         </tr>
         </table>

         </form>
Back to top
View user's profile Send private message
ChrisFah
Smarty Pro


Joined: 02 Nov 2009
Posts: 159
Location: Traun, Austria

PostPosted: Sun Jun 13, 2010 8:08 am    Post subject: Reply with quote

Hi,
if you want to avoid the real email address in the page source of the browser, you could use the user_id instead, and in forms action script you can select users email address user_id. So the writer of the mail can only see the addressees user Id, but not his email.

Regards, Chris
Back to top
View user's profile Send private message
prova17
Smarty Rookie


Joined: 24 May 2010
Posts: 6

PostPosted: Sun Jun 13, 2010 9:40 am    Post subject: Reply with quote

Thank you very much for your tip.
I'm not really good with smarty.

Do you have a guide or a web where can I see some example??

Thanks in advance..

I'm really confused!!

I tried to use a php code but it is not work!!

<?php
$str = '{$user_fromid->email}';
echo base64_encode($str);
?>

Why??

Thanks
Back to top
View user's profile Send private message
ChrisFah
Smarty Pro


Joined: 02 Nov 2009
Posts: 159
Location: Traun, Austria

PostPosted: Sun Jun 13, 2010 8:08 pm    Post subject: Reply with quote

Hi,

use something like this:
template:
Code:

<form name="send_mail" action="http://www.domain.com/mailing.php" method="post" enctype="multipart/form-data">
Put everything you need in this form...
here userid of receiver is to enter manually
<input name="mail_to_id" type="text" value=""> OR IF AVAILABLE
here userid of receiver is given as php var $receiving_user_id
<input type="hidden" name="mail_to_id" value="<?php echo $receiving_user_id; ?>">

<input name="mail_from" type="text" value="">
<input name="message" type="text" value="">
<input type="hidden" name=" <?php session_name(); ?>" value="<?php session_id(); ?>">
</form>


in action script mailing.php use this

Code:
if (isset($_POST['mail_to_id'])) {
  $receiver_id = (int)$_POST['mail_to_id'];
  --do mysql connect +select blablabla ...
  $result = mysql_query ("select email from users where id ='".$receiver_id."' ");
  receiver_email = $result['email']; // there is only one result so skip mysql_fetch_array
}

then use your email routine to sent mail
alll other data are stored in $_POST['message'] and so on...

ready.
Hope it will help a little bit...
regards, Chris
Back to top
View user's profile Send private message
prova17
Smarty Rookie


Joined: 24 May 2010
Posts: 6

PostPosted: Mon Jun 14, 2010 5:06 pm    Post subject: Reply with quote

Thank you very much for your help.
I have tried but It is not work.
It's my fault because I don't know how can I use smarty.
I have a lot of problem using smarty and php, it looks like incompatible.

Never mind!

Thanks
Back to top
View user's profile Send private message
ChrisFah
Smarty Pro


Joined: 02 Nov 2009
Posts: 159
Location: Traun, Austria

PostPosted: Mon Jun 14, 2010 8:46 pm    Post subject: Reply with quote

Well, when you are not used to smarty, do it with pure php to finish your work. When you have enough time, read the fine manual carefully, its only about 200 pages, and then rebuild your site with smarty.

When you need examples using smarty in a bigger project, have a look at xt:commerce. Its a fork of os-commerce, an online shop software using smarty. There you can easily look at the easy technics on using smarty without all those difficult ways.

regards, Chris
Back to top
View user's profile Send private message
prova17
Smarty Rookie


Joined: 24 May 2010
Posts: 6

PostPosted: Wed Jun 16, 2010 2:40 pm    Post subject: Reply with quote

Thanks,
you are very kind.

I want to try to hear your first advice.

Code:
<form id="em" action="java-script:void(null);">
         {if $user->get('gid') != 0}
         <table cellpadding="5" cellspacing="0" border="0" width="100%" id="jetablelatest">
         <tr>
            <td  align="left">
            <p><label for="Price">{JText text="JE_EMAILFORM_FROM"}</label> <input type="text" name="name" size="30" value="{$user->username}"></p>
            <p><label for="Price">{JText text="JE_EMAILFORM_EMAIL"}</label> <input type="text" name="from" size="30" value="{$user->email}"></p>
            <p><label for="Price">{JText text="JE_EMAILFORM_PHONE"}</label> <input type="text" name="phone" size="30"></p>
                       
            <p><label for="Price">REF Number</label> <input type="text" name="ref_oggetto" size="30" class="required" value="es. REF123456789"></p>
            <p><label for="Price">{JText text="JE_EMAILFORM_MESSAGE"}</label><textarea name="body" cols="25" rows="7"></textarea></p>

            <p><input type="button" value="{JText text='JE_EMAILFORM_SENT'}" class="submit" onClick="xajax_JomestateController.sendemail(xajax.getFormValues('em'));"></p>
            <input type="hidden" name="subject" value="{$item->ad_ref} - {JText text='JE_EMAILFORM_SUBJECT'}">
            <input type="hidden" name="to" value="{$user_fromid->id}" size="30">
            <p><div id="email"></div></p>
            </td>
         </tr>
         </table>

         </form>


I changed the email user with the id_user.

When I try to send the email I use this function:

Code:
function sendemail($tablica)
   {
   
      $this->tpl =& new Smarty_WebApp('homepage');   
      $objResponse = new xajaxResponse();
      
      jimport( 'joomla.mail.helper' );
      
      $tablica['body']    = JMailHelper::cleanBody($tablica['body']);
      $tablica['subject'] = JMailHelper::cleanSubject($tablica['subject']);
      $tablica['to']       = JMailHelper::cleanAddress($tablica['to']);
      
      $tablica['body'] = "From: ".$tablica['name']."<br> Numero di telefono: " .$tablica['phone']."<br> REF Oggetto:" .$tablica['ref_oggetto']."<br><br><br> Messaggio: ".$tablica['body'];
      
      if (!JMailHelper::isEmailAddress($tablica['from']) )
      {
         $objResponse->assign('email', "innerHTML", '<p id="error">Incorretto indirizzo email!.</p>' );
      }

      
      elseif ( JUtility::sendMail($tablica['from'], $tablica['name'], $tablica['to'],$tablica['subject'], $tablica['body'],$mode = true ) !== true )
      {
            $objResponse->assign('email', "innerHTML", '<p id="error">Errore, email non inviata.</p>' );

      } else {
            $objResponse->script("document.getElementById('em').reset()");
            $objResponse->assign('email', "innerHTML", '<p id="success">Grazie, email inviata.</p>' );
      }
         
      return $objResponse;
      }
      
   
}

//XAJAX
$card = new JomestateController();
$xajax = new Xajax_WebApp();   
$xajax->register( XAJAX_CALLABLE_OBJECT, $card );
$xajax->processRequest();
$document =& JFactory::getDocument();
$document->addCustomTag($xajax->getJavascript());


Do you have any idea how can I convert the id_user to user mail when i click "send" in the email form?

REALLY, REALLY THANK YOU!
Back to top
View user's profile Send private message
César
Smarty n00b


Joined: 01 Feb 2011
Posts: 1

PostPosted: Tue Feb 01, 2011 4:45 am    Post subject: Reply with quote

Well, have you try to search in online by using the google search. I think you can found there some topic that related in your problem. However, try also to check the setting of your email maybe there’s a setting that you need to change.
Back to top
View user's profile Send private message
C4ss4ndr4
Smarty n00b


Joined: 09 Feb 2011
Posts: 1

PostPosted: Wed Feb 09, 2011 9:03 am    Post subject: Reply with quote

Well, you can avoid the real email address in the page source in some browser. Maybe you can use some id_user instead some forms in action script that you can select. However, you can search in online by using some search engine like google.

My Sports Email
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty Development All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP