Provider header information from emails

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
pVortex
Posts: 7
Joined: 08 Nov 2007, 14:19

Provider header information from emails

Post by pVortex »

We have email parsing running successfully. However, when a bug is updated via email, the note that is added to the bug does not include any information regarding who sent the email, and displays as "Mail (reporter)". (Reporter being the security level that Mail is set to.)

My question is: is there anyway to grab the sender from the header information of the email and have it be placed in the body of the email so that when the note is added to the bug we know who sent the email update?

Thanks.
NT
Posts: 21
Joined: 30 Oct 2007, 13:35

Re: Provider header information from emails

Post by NT »

try setting

$g_mail_save_from = ON;

It gave me a line at the top of the issue Description like:-
Report from: "aaaaaa" <username@aaaaaa.xxx.yyy.zzz.com>

not great you could alter it in mail_api.php.

Nick
pVortex
Posts: 7
Joined: 08 Nov 2007, 14:19

Re: Provider header information from emails

Post by pVortex »

Thanks for the response.

It appears that $g_mail_save_from = ON; is already set in our system. I looked at little deeper and found this in mail_api.php:

Code: Select all

if ( $t_mail_use_reporter ) {
                        // Always report as mail_reporter
                        $t_reporter_id = user_get_id_by_name( $t_mail_reporter );
                        $t_reporter = $t_mail_reporter;
                } else {
                        // Try to get the reporting users id
                        $t_reporter_id = user_get_id_by_mail ( $v_mailaddress );
                        echo 'Reporter: ' . $t_reporter_id;
...
Does each incoming message run through this code? (If yes, where do I look to see what $t_mail_user_reporter is set to?)
NT
Posts: 21
Joined: 30 Oct 2007, 13:35

Re: Provider header information from emails

Post by NT »

$t_mail_user_reporter is set at the top of function mail_get_user:-

Code: Select all

	# return the user id for the mail reporting user
	function mail_get_user ($p_mailaddress) {
		$t_mail_use_reporter	= config_get( 'mail_use_reporter' );
		$t_mail_auto_signup	= config_get( 'mail_auto_signup' );
		$t_mail_reporter	= config_get( 'mail_reporter' );	
This function is called in function mail_add_bug:-

Code: Select all

		$t_bug_data->project_id			= $p_account['id'];

		$t_bug_data->reporter_id		= mail_get_user( $p_mail['From'] );

		if ( mail_is_a_bugnote( $p_mail['Subject'] ) ) {
			# Add a bug note
Looking at the code in function mail_get_user, you will either have to set $g_mail_auto_signup = ON, or
the sending email address will have to already have to be a mantis user for this to work.

Nick
Post Reply