Searching for the answer I found this script here
However:
It can send body of received email as plain text only. In order not to lose data (links) I need to send body in same format as it was received.
Is there a simple change for this script to achieve that?
btw, Later, I need to save linked files (from email) on my server, and replace links in the body with my own.
Thanks.
UPDATE
Somehow i solved the first issue (adding original boundery value in my email), now, i have 3 more to go. This code returns 1 with print_r($urls)
$pattern = '#^http://domain.com/(.*)(\w*)0\b#';
preg_match_all($pattern, $email, $urls);
same code returns empty array with those two outputs:
1 print_r($urls, true)
2 print_r($urls[0], true)
like this:
1
Array
(
[0] => Array
(
)
[1] => Array
(
)
[2] => Array
(
)
)
2
Array
(
)
However, when I test code here, it works like charm
How can I get my values? It will be very nice to have them in a variables, like $url1, $url2…
Can anybody help? (Your time and effort is highly appreciated!)
I will answer on my question.
Ok, I already solved this. Here is some info if somebody need it…
Regex had an extra
^. Further on I improved pattern like this:"#http://domain.com/([=a-zA-Z\d/-]+)(.|\n|\r)([a-zA-Z\d/-]+)#"This urls have=and that was removed with this line:$var1=preg_replace("#=(.|\n|\r)#","",$var);This is not the best way to go, but it worked. I got my links in array, and later I was able to download files withfile_get_contents()andfile_put_contents()changing links was easy withstr_replace. Everything is done with for loop because number of links in each email was not the same.Happy Holidays everybody!