B4J Question PayPal Email replying?

aidymp

Well-Known Member
Licensed User
Longtime User
Hi I have been using the "Email based server" example Here as a way of processing sales from a site called Selz. - Anyway after a year of messing with them, I have decided to move to PayPal direct and just use payment buttons on my site. So I was hoping that it would be an easy code edit to look at emails , watch out for ones from PayPal, and then if it contains my product ID, I would reply to the email address in the email (Not the email address the mail was sent from) with an access code! nice and simple! But for some reason it proving very difficult. As the email address is my main email address I get lots of emails.

The problems I am getting are SOME emails look like HTML! Some look like a mass of letters (MIME??) And some just seem to crash the server. with errors like : java.io.FileNotFoundException: C:\Users\Adrian\AppData\Local\Temp\=?utf-8?B?Vm91Y2hlciBDb2RlcyZVbmJlYXRhYmxlIFByaWNlIFByb2R1Y3RzIDQueGxz?= (The filename, directory name, or volume label syntax is incorrect)

I was hoping to just look for mails from paypal, see if they have my product ID in them and then reply to the email address stored inside the msg.body!

Does anyone have some code for this?

Thanks

Aidy
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Do you have a public server? If yes then a better solution will be to use PayPal IPN service.

About the mails solution, don't parse all mails. Instead use regex or a simple MessageText.IndexOf to look for a unique string that belongs to PayPal.

Only if the message is a PayPal message you should parse it with MailParser.
 
Upvote 0

aidymp

Well-Known Member
Licensed User
Longtime User
Do you have a public server? If yes then a better solution will be to use PayPal IPN service.

About the mails solution, don't parse all mails. Instead use regex or a simple MessageText.IndexOf to look for a unique string that belongs to PayPal.

Only if the message is a PayPal message you should parse it with MailParser.

Hi thanks for that, I got a little further, but the msg.body only contains a bit of html? not the full email?
 
Upvote 0

aidymp

Well-Known Member
Licensed User
Longtime User
How are you testing it? The Log message may be truncated.

I have semi solved this - I was working with messages after they came out of the mailparser! Im now working with the raw email and its working much better.
 
Upvote 0
Top