Page 1 of 1

Custom Email Header per MTA?

PostPosted: Wed Oct 16, 2013 5:44 am
by sendmedia
Hi,

I know iv posted alot of questions on these forums the past few days, but i thought id post them here so other users dont ask the same question as im sure at some point other people will want to know this stuff too.

My question is, is there any way of adding a custom email header per MTA?

For for example

MTA1 = X-MC-Subaccount: mail1
MTA2 = X-MC-Subaccount: mail2
MTA3 = X-MC-Subaccount: mail3

and so on?

I need this feature added please.

Re: Custom Email Header per MTA?

PostPosted: Wed Oct 16, 2013 6:03 am
by sendmedia
or i might be able to do this myself. But need a little help.

Am i right in saying to add email headers i need to edit the following file:

/admin/functions/api/ss_email.php

If so then where it has this bit:

Code: Select all
if ((int)$this->statid > 0) {
         $extra_headers[] = 'List-Unsubscribe: <%%HEADER_UNSUBSCRIBELINK%%>';
         $extra_headers[] = 'X-Mailer-RecptId: %%HEADER_SUBSCRIBERID%%';
         $extra_headers[] = 'X-Mailer-SID: ' . (int)$this->statid;
      }


I'll change it to the following:

Code: Select all
if ((int)$this->statid > 0) {
         $extra_headers[] = 'List-Unsubscribe: <%%HEADER_UNSUBSCRIBELINK%%>';
         $extra_headers[] = 'X-Mailer-RecptId: %%HEADER_SUBSCRIBERID%%';
         $extra_headers[] = 'X-Mailer-SID: ' . (int)$this->statid;
if ($from = '[email protected]') {
   $extra_headers[] = 'X-MC-Subaccount: mail1';
}
if ($from = '[email protected]') {
   $extra_headers[] = 'X-MC-Subaccount: mail2';
}
if ($from = '[email protected]') {
   $extra_headers[] = 'X-MC-Subaccount: mail3';
}
if ($from = '[email protected]') {
   $extra_headers[] = 'X-MC-Subaccount: mail4';
}
      }


Would that work? If so then theres 1 thing i need help with. You can see iv used $from to get the from address the emails will be sent from, but no where in that php file can i find the correct variable to use which stores the from address, do you know what it is and will my above modification work once i use the right from variable?

Thanks

Re: Custom Email Header per MTA?

PostPosted: Wed Oct 16, 2013 7:56 am
by MaBoRaK
loading.......

Excellent implementation.

At this point the FROM MAIL is the same assigned in the MTA details.

Image

And the custom mail from configured in your mta

Image

So you can access to the Current MAIL FROM ( reply or bounce ) with:

Code: Select all
if ((int)$this->statid > 0) {
         $extra_headers[] = 'List-Unsubscribe: <%%HEADER_UNSUBSCRIBELINK%%>';
         $extra_headers[] = 'X-Mailer-RecptId: %%HEADER_SUBSCRIBERID%%';
         $extra_headers[] = 'X-Mailer-SID: ' . (int)$this->statid;
$from = Mta_API::Singleton()->mta['current_mta']['mail_from'];  // <---- HERE 
if ($from = '[email protected]') {
   $extra_headers[] = 'X-MC-Subaccount: mail1';
}
if ($from = '[email protected]') {
   $extra_headers[] = 'X-MC-Subaccount: mail2';
}
if ($from = '[email protected]') {
   $extra_headers[] = 'X-MC-Subaccount: mail3';
}


For reply:

Code: Select all
Mta_API::Singleton()->mta['current_mta']['mail_reply'];


for bounce:

Code: Select all
Mta_API::Singleton()->mta['current_mta']['mail_bounce'];



Please try.

connection closed.

Re: Custom Email Header per MTA?

PostPosted: Wed Oct 16, 2013 9:01 am
by sendmedia
Right iv edited the code to the following:

Code: Select all
if ((int)$this->statid > 0) {
         $extra_headers[] = 'List-Unsubscribe: <%%HEADER_UNSUBSCRIBELINK%%>';
         $extra_headers[] = 'X-Mailer-RecptId: %%HEADER_SUBSCRIBERID%%';
         $extra_headers[] = 'X-Mailer-SID: ' . (int)$this->statid;
         $fromemail = Mta_API::Singleton()->mta['current_mta']['mail_from'];
         if ($fromemail = '[email protected]') {
               $extra_headers[] = 'X-MC-Subaccount: mail1';
         }
         if ($fromemail = '[email protected]') {
            $extra_headers[] = 'X-MC-Subaccount: mail2';
         }
         if ($fromemail = '[email protected]') {
            $extra_headers[] = 'X-MC-Subaccount: mail3';
         }
         if ($fromemail = '[email protected]') {
            $extra_headers[] = 'X-MC-Subaccount: mail4';
         }
         if ($fromemail = '[email protected]') {
            $extra_headers[] = 'X-MC-Subaccount: mail5';
         }
      }


But it doesnt seem to work, i think the problem is the code which gets the free email address

Code: Select all
$fromemail = Mta_API::Singleton()->mta['current_mta']['mail_from'];


Are you sure that piece of code will work in the file where editing?

Re: Custom Email Header per MTA?

PostPosted: Wed Oct 16, 2013 9:02 am
by sendmedia
*from email address

cant edit my post for some reason to make the change.

Re: Custom Email Header per MTA?

PostPosted: Wed Oct 16, 2013 9:07 am
by sendmedia
After looking at this again no headers what so ever are showing in the emails.

Code: Select all
$extra_headers[] = 'List-Unsubscribe: <%%HEADER_UNSUBSCRIBELINK%%>';
         $extra_headers[] = 'X-Mailer-RecptId: %%HEADER_SUBSCRIBERID%%';
         $extra_headers[] = 'X-Mailer-SID: ' . (int)$this->statid;


the above headers dont show either, i tried different ESPs and also the localhost one and all the test emails iv sent have'nt shown the headers.

Maybe its because i did a test smtp connection email and not a real campaign, ill do more testing now.

Re: Custom Email Header per MTA?

PostPosted: Wed Oct 16, 2013 9:19 am
by sendmedia
Ok another update, i had the actually send an email campaign out for the headers to be added.

How ever now we have another problem, ALL the extra headers are showing, even if the from email address does not match :(

I need some help on this please.

Re: Custom Email Header per MTA?

PostPosted: Wed Oct 16, 2013 1:18 pm
by MaBoRaK
loading.......

Please post your complete PHP file.

connection closed.

Re: Custom Email Header per MTA?

PostPosted: Wed Nov 06, 2013 4:08 am
by sendmedia
Hey,

I'll pay you $100 if you can get this working please....

Thanks