URL in the mail body

joseanquiles

Member
Licensed User
Longtime User
Hello everyone,
I am trying to put a URL in the body of a SMTP object.

smtp.Body = "http://host/action?a=40.23"

eMail is correctly sent.
However, when I read it the mail, the URL is altered:

http://host/[email protected]

It seems that =40 is a special code or similar, and it is changed to @
How can I solve this problem?

Thank you in advance.
Jose Antonio
 

joseanquiles

Member
Licensed User
Longtime User
In principle, you can include any type of URL.
I am using a http URL (google maps), but I don't see any problem to use any kind of URL.
Can you show me an example of your URL?
 
Upvote 0

JorgeMC

Member
Licensed User
Longtime User
This is the code:


B4X:
Sub GPS_LocationChanged (Location1 As Location)
   
   lon = Location1.ConvertToSeconds(Location1.Longitude)
   lat= Location1.ConvertToSeconds(Location1.Latitude)
   SMTP.Initialize("smtp.gmail.com", 465, "[email protected]", "pass", "SMTP")
    SMTP.UseSSL = True 
   SMTP.To.Add("[email protected]")
    SMTP.Subject = "Subject"
    SMTP.HtmlBody= True 
    SMTP.Body = "http://maps.google.com/staticmap?center= "&Location1.Latitude&","& Location1.Longitude&"&zoom=14&size=400x400&markers= "&Location1.Latitude&","& Location1.Longitude&"&key=12345"
    SMTP.Send
   
   
End Sub

The URL that receives the mail is this:

B4X:
http://maps.google.com/[email protected],-1.23456789&zoom&size@0x400&[email protected],-1.23456789&key�345
 
Upvote 0

joseanquiles

Member
Licensed User
Longtime User
Hi Jorge,
add the following line before calling Send:

mySMTP.AddAttachment(File.DirAssets,"foo.png")

Furthermore, remove HtmlBody = True

foo.png is any existing file, but it is not used.

Try it and comment.

Jose Antonio
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
I've just been playing with this, thanks for the info in the thread which I realize is old now, but for anybody still using it that doesn't want to have to add an attachment, if you use '=3D' (dec 66) in place of an equals sign '=' in the body it will work. As joseanquiles pointed out the equals sign is a special character so using the Hex code to represent itself gets around it.
 
Last edited:
Upvote 0
Top