I created procedure to send mail via pl/sql oracle. I add image (.png) as attachment to mail and open it in mail footer (company logo). Most of mails are correct but sometimes image in footer is blurred. I don't know how fix it :/
This is example of incorrect footer image:

This is part of code with footer and attachment
UTL_SMTP.write_data(v_connection, 'MIME-Version: 1.0' || UTL_TCP.crlf);
UTL_SMTP.write_data(v_connection,
'Content-Type: multipart/mixed; boundary="' ||
c_mime_boundary || '"' || UTL_TCP.crlf);
UTL_SMTP.write_data(v_connection, UTL_TCP.crlf);
UTL_SMTP.write_data(v_connection,
'This is a multi-part message in MIME format.' ||
UTL_TCP.crlf);
UTL_SMTP.write_data(v_connection,
'--' || c_mime_boundary || UTL_TCP.crlf);
UTL_SMTP.write_data(v_connection,
'Content-Type: text/html; charset="UTF-8"' ||
UTL_TCP.crlf);
UTL_SMTP.write_data(v_connection, UTL_TCP.CRLF);
-----------------------------------
ClobLen := DBMS_LOB.GETLENGTH(p_message);
LOOP
EXIT WHEN offset > ClobLen;
DBMS_LOB.READ(p_message || '<br><br>' || p_footer
, amount, offset, BUFFER);
UTL_SMTP.write_raw_data(v_connection, UTL_RAW.cast_to_raw(BUFFER));
offset := offset + amount;
END LOOP;
UTL_SMTP.write_data(v_connection, UTL_TCP.CRLF);
IF p_attach_name IS NOT NULL THEN
UTL_SMTP.write_data(v_connection, '--' || c_mime_boundary || UTL_TCP.crlf);
UTL_SMTP.write_data(v_connection, 'Content-Type: ' || p_attach_mime || '; name="' || p_attach_name || '"' || UTL_TCP.crlf);
UTL_SMTP.write_data(v_connection, 'Content-Transfer-Encoding: base64' || UTL_TCP.crlf);
UTL_SMTP.write_data(v_connection, 'Content-Disposition: attachment; filename="' || p_attach_name || '"' || UTL_TCP.crlf || UTL_TCP.crlf);
FOR i IN 0 .. TRUNC((DBMS_LOB.getlength(p_attach_blob) - 1 )/offset) LOOP
UTL_SMTP.write_data(v_connection, UTL_RAW.cast_to_varchar2(UTL_ENCODE.base64_encode(DBMS_LOB.substr(p_attach_blob, offset, i * offset + 1))) || UTL_TCP.crlf);
END LOOP;
UTL_SMTP.write_data(v_connection, UTL_TCP.crlf);
END IF;
-----------------------------------
UTL_SMTP.close_data(v_connection);
UTL_SMTP.quit(v_connection);
There are multiple places where errors could occur and you need to do some debugging to work out where the error is coming from.
Compare the bytes of the image in the database to the bytes of the image in the received e-mail message - are they identical?
If so then the problem either:
In both cases this is a data problem and not a code problem.
If not then you have a problem somewhere between the database and the recipient.
In the latter case, compare the database bytes with the bytes in the sent email - are they identical?
In the latter case, compare the data put into the database with the data read from the database.
INSERTed or when it is beingSELECTed and you need to find out which.