[Fixed] Not sure if it's a bug or not

Use this forum to report bugs you find in the software.
Forum rules
We have no special rules for UVK forums. Just try to be polite and clear in your posts.
Please don't post spam in this forum. Spammers will be banned by IP, e-mail and username.
We reserve the right to delete all posts and ban all users we consider not having respected these rules without warning.
Post Reply
Charger440
Posts: 1529
Joined: Sun May 25, 2014 7:44 am
Location: Missouri

[Fixed] Not sure if it's a bug or not

Post by Charger440 »

Fred

For the last 24 hours or so, on two different computers UVK won't send an email

It just keeps saying email cant be sent. I am using the right email too :)
Last edited by Charger440 on Sat Jan 09, 2016 12:07 am, edited 2 times in total.
Jim

It is not "Can it be done?" but rather, "How can we do it?"
Brink
Posts: 283
Joined: Thu Jun 12, 2014 3:36 pm

Re: NOt sure if it's a bug or not

Post by Brink »

Obvious question: Do you have another email account on another server that you can try?
Fred
Site Admin
Posts: 2370
Joined: Sat Jul 30, 2011 12:05 pm
Location: Red coast, France
Contact:

Re: NOt sure if it's a bug or not

Post by Fred »

Thanks, Jim. I've been experiencing some server side problems since I updated PHP. I'll try to fix that bug ASAP.
One thing we humans have in common is that we are all different. So, if you think you're weird because you're different from everyone else, then we are all weird.

Fred
Charger440
Posts: 1529
Joined: Sun May 25, 2014 7:44 am
Location: Missouri

Re: Not sure if it's a bug or not

Post by Charger440 »

Also Fred,

Would it be possible to add another email address? I guess I could just filter the mail but in my case I would like to send the mail to an entirely different server than the one I used to register. I don't know... Just spit balling here... maybe I should just filter it....
Jim

It is not "Can it be done?" but rather, "How can we do it?"
Fred
Site Admin
Posts: 2370
Joined: Sat Jul 30, 2011 12:05 pm
Location: Red coast, France
Contact:

Re: Not sure if it's a bug or not

Post by Fred »

Jim, I'll add support for an extra email address in the new C++ UVK. It's actually a good idea.

I fixed the bug. It turns out that PHP does not allow multiple line breaks in mail headers. In case someone else is having the same problem, more info can be found here:
http://stackoverflow.com/questions/3088 ... nal-header

The new PHP function I made to send mail with attachments is as follows:

Code: Select all

function mail_attachment($to, $subject, $message, $from, $file, $msgtype = "text/html") {
	$fname = basename($file);
	$uid = md5(uniqid(time()));		
	$eol = PHP_EOL;
	$sep = md5(time());
		
	// multipart header
	$headers = "From: " . $from . $eol
	. "MIME-Version: 1.0" . $eol
	. "Content-Type: multipart/mixed; boundary=\"" . $sep . "\"". $eol
	. "Content-Transfer-Encoding: 7bit" . $eol
	. "This is a MIME encoded message.";
	
	// message body
	$body = "--" . $sep . $eol
	. "Content-Type: ". $msgtype . "; charset=\"utf-8\"" . $eol
	. "Content-Transfer-Encoding: 8bit" . $eol . $eol
	. $message . $eol
	
	// attachment
	. "--" . $sep . $eol
	. "Content-Type: application/octet-stream; name=\"" . $fname . "\"" . $eol
	. "Content-Transfer-Encoding: base64" . $eol
	. "Content-Disposition: attachment; filename=\"" . $fname . "\"" . $eol . $eol
	. chunk_split(base64_encode(file_get_contents($file))) . $eol
	. $sep . "--";
	return mail($to, $subject, $body, $headers);
}
One thing we humans have in common is that we are all different. So, if you think you're weird because you're different from everyone else, then we are all weird.

Fred
Post Reply