[Vtigercrm-developers] Individual Email Outgoing Server settings (solution)
Joe Bordes
joe at tsolucio.com
Wed Nov 21 07:01:07 PST 2012
Hi,
vtiger_systems table is used for some other configurations. server_path
is used for the ftp backups
I do have one question: can you explain what motivates this change? I
mean, the application works correctly without this change in the
majority of servers, so why bother? What am I missing?
Joe
TSolucio
On 21/11/12 14:57, mail at dvoges.de wrote:
> Hello Community,
>
> I solved the problem, that emails out of vtiger are send by one common
> email account. With this solution it is possible to provide every user
> an individual smtp account.
>
> 1) Changes in the DB (setting and values)
>
> Table: ?vtiger_systems? New Column: "user" with varchar(63) => here is
> the user name of the email sender which should match with
> ?vtiger_users?->?user_name?.
> As ?vtiger_systems?->?Server_Type? I use the value ?usermail?.
> The rest fields are filled with the individual outgoing mail server
> account data.
> Please pay attention to ?vtiger_systems_seq? and set the increases
> index value of ?vtiger_systems?.
>
> There is no GUI for register new entries, it has to be done manually by sql.
> (Question: There is a field ?vtiger_systems?->?server_path? which is
> not shown or editable in the vtiger gui, but it is necessary for our
> email provider, is this a bug?)
>
>
> 2) Changes in the code
>
> I replaced the function ?getFromEmailAddress? in the file
> "\modules\MailManager\src\models\Draft.php" with
>
> ##############################################
> function getFromEmailAddress() {
> global $adb, $current_user;
> $fromEmail = false;
> if (Vtiger_Version::check('5.2.0', '>=')) {
> $smtpFromResult = $adb->pquery('SELECT from_email_field FROM
> vtiger_systems WHERE server_type=? and
> user="'.$current_user->column_fields['user_name'].'"',
> array('usermail'));
> if ($adb->num_rows($smtpFromResult)) {
> $fromEmail = decode_html($adb->query_result($smtpFromResult,
> 0, 'from_email_field'));
> }
> else {
> $smtpFromResult = $adb->pquery('SELECT from_email_field FROM
> vtiger_systems WHERE server_type=?', array('email'));
> if ($adb->num_rows($smtpFromResult)) {
> $fromEmail =
> decode_html($adb->query_result($smtpFromResult, 0, 'from_email_field'));
> }
> }
> }
> if (empty($fromEmail)) $fromEmail = $current_user->column_fields['email1'];
> return $fromEmail;
> }
> ##############################################
>
> The function at first tries to find an individual email by ?usermail?
> and ?user->name?, if this has no result it uses the old method by
> searching the ?mail? ? Data.
>
>
> I would like to hear some feedback. Questions are also welcome.
>
> Best wishes from Munich, Germany
>
> Detlef Voges
>
>
>
>
>
> _______________________________________________
> http://www.vtiger.com/
More information about the vtigercrm-developers
mailing list