How put image on Email

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

Ardito
Posts: 128
Joined: 12 Sep 2016, 11:26
Location: Italy

How put image on Email

Postby Ardito » 13 Feb 2020, 16:54

Hi,
I am trying to insert an image in the emails I send via SFS2x, I use this code:

Code: Select all

private void sendEmailToken(String address, String token) throws Exception
   {
      Email myEmail = new SFSEmail(
            sender,
            address,
            "New Password Request Notification",
            //"<img src=https://images-na.ssl-images-amazon.com/images/I/71Sz-66SR5L._SX425_.jpg>" //WORK
               "<img src=http://sniffout.ddns.net/img/3.png>" //NO WORK
               + "New Password Request Notification<br><br>"
               + "Confirmation code:<br>"
               + token
               + "<br><br>NB. The code will be valid for a maximum of 1 hour.");

      SmartFoxServer.getInstance().getMailService().sendMail(myEmail);
   }

I have uploaded the images on FileZilla, I have a dns with noip.com, when I go to the e-mail, the image is not displayed.
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: How put image on Email

Postby Lapo » 14 Feb 2020, 08:21

Hi,
you're missing quotes around the src attribute.
In other words...

No:

Code: Select all

<img src=http://mysite/image.png />

Yes:

Code: Select all

<img src="http://mysite/image.png" />


Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
Ardito
Posts: 128
Joined: 12 Sep 2016, 11:26
Location: Italy

Re: How put image on Email

Postby Ardito » 14 Feb 2020, 11:58

I use:

Code: Select all

"<img src=\"http://sniffout.ddns.net/img/3.png\">"


But it does not work
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: How put image on Email

Postby Lapo » 14 Feb 2020, 14:22

Something is wrong with the image, maybe?
Lapo

--

gotoAndPlay()

...addicted to flash games
Ardito
Posts: 128
Joined: 12 Sep 2016, 11:26
Location: Italy

Re: How put image on Email

Postby Ardito » 15 Feb 2020, 01:17

No, it's a normal image, I seem to understand that the string is correct, so I think that the problem is FileZilla..

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 105 guests