Legacy vbulletin 4 plugin: Make sendmessage.php use default address and add REPLYTO field in

Status
Not open for further replies.

Atled

Customer
Hello,

requesting custom work, here the project description:
---------------------------------------------------------------------------
We are in the process of moving all our vBulletin 4 sites over to transaction emails via Amazon SES.

During the initial conversation, we have identified a slight stumbling block in the way vBulletin handles the "Contact Us" form.

Mails sent via this form use the FROM address of the person sending the email

https://cdn.mattwservices.xyz/data/attachment-files/2016/07/4456_upload_2016-7-28_1-28-5.png

and sends the email to the address specified in the ACP settings.

This fails to send via Amazon SES, because all sending domains need to be validated.

Would it be possible to request a quote for the development of an addon which changes the behavior of the Contact Us form, so it sends the mail from the default address in vBulletin, and sets a correct REPLY TO field in the mail? This allows the use of SES.

https://cdn.mattwservices.xyz/data/attachment-files/2016/07/4457_upload_2016-7-28_1-30-12.png

In our specific case, it will always be sent from noreply@domain.com, sent to the contact address of info@domain.com, and have the mail set a correct REPLY TO field which is the address of the person using the contact us form.
---------------------------------------------------------------------------


Example
Currently emails that are being send by members through the forum, are being handled by vbulletin like this:
-> User sends an email through the forum
-> vbulletin puts the users email address (e.g. john@example.com) in the FROM field for the email
-> Amazon SES blocks the email because example.com is not validated in our Amazon SES account and we dont have permission to send messages on behalf of example.com

What we need:
-> User sends an email through the forum
-> vbulletin puts our default email address (e.g. noreply@forum.tld) in the FROM field for the email and puts the users email address (e.g. john@example.com) in the REPLYTO field of the mail (which currently does not exist and needs to be added to the sendmessage.php mailing process)
-> as we send out the email through our domain forum.tld which is validated in Amazon SES there is no problem in sending out that email
-> When I reply to the contact message or a user wants to reply to an email that he got from another member, the email in the REPLYTO field should be the one who receives the mail (so the reply should be send to john@example.com and not to noreply@forum.tld)

That is also how Xenforo handles its contact form.


Plugin.
- Can this be solved through a vbulletin plugin or will we have to edit core files of vbulletin?


Sendmessage.php
- Will you solve that on a fundamental level or will your solution be specific to the contact form? Because I think there are other parts of vbulletin that also don’t sent the mail through the noreply@domain.com email address. I have not tested it yet, but I think if you send an email to another user, the same problem occurs. I think also when you want to recommend a thread to a friend and send him an email, this also happens. Though it seems they all use the sendmessage.php script for that.

I just checked the sendmessage.php script and we have the following functions that dont send emails through the forums default email address but instead use the users email address,
- Contact form, see heading in sendmessage.php script
######## do contact webmaster #######

- Send email to friend, see heading in sendmessage.php script
####### start send to friend #########

- members sending each other emails, see heading in sendmessage.php script
###### start mail member #######

- there is also something with social media services, not quite sure what that is and if an email gets sends there as well:
Code (Text):
'im_send_aim',
'im_send_yahoo',
'im_send_msn',
'im_send_skype',
'im_message'
In general please check the sendmessage.php file yourself and analyze what needs to be done and then do that. I cant tell you what to do as I am not a coder. You need to evaluate the problem and solve it.

Can we make this plugin that we are going to create specific to the sendmessage.php functions? I dont want this plugin to interfere with normal transactional emails in vbulletin (notification mails etc.).
 
Upvote 0
This suggestion has been closed. Votes are no longer accepted.
Try opening sendmessage.php

Find
PHP:
vbmail($destemail, $subject, $message, false, $vbulletin->GPC['email'], '', $name);

Change to
PHP:
vbmail($destemail, $subject, $message, false, 'noreply@domain.tld', "Reply-To: <" . $vbulletin->GPC['email'] . ">\r\n", $name);

No idea if this will work, but it's possible :)
 
Could you create a plugin for that? Its just not a good idea to directly edit core files of vbulletin and they will be overwritten anyways when a new patch or update gets applied. All paid time of course.
 
No, it's not possible to create a plugin for that unfortunately. The only thing that could be done (which you don't need me for) is to make a copy of sendmessage.php (call it sendmessage2.php or something else), apply the change to this copy, then change the option in the vBulletin Options to point to your copy instead of the original.
 
I always hire at least two people for the same job and then compare the results. The other guy that I hired created a plugin for that and I was wondering if you could review his code for me and tell if he done a good job and if you see any issues or problems with his solution. Of course I can pay you some money for your review of the code and your opinion.

Here the code (actually just a couple of lines):
Code:
	<plugins>
		<plugin active="1" executionorder="5">
			<title>Modify Email Headers</title>
			<hookname>mail_send</hookname>
			<phpcode><![CDATA[if (!empty($from))
{
	$headers = str_replace("From:", "Reply-To:", $headers, $count);

	if ($count)
	{
		$headers .= "From: $mailfromname <" . $vbulletin->options['webmasteremail'] . '>' . $delimiter;
	}
}]]></phpcode>
		</plugin>
	</plugins>

I tested the script and it seems to work. I was just wondering what you think about the way he solved it and if its a good solution and if the code quality is good. Of course paid time.
 
Hello Atled,

This ticket has now been closed with the status Implemented.

We hope your issue or question has been addressed to your satisfaction. If not, please feel free to re-open it by clicking this link.

If you have any further issues or questions, please feel free to start a new support ticket via the button at the top of every page.

Thank you!
 
Status
Not open for further replies.
Back
Top