Hi, guys,
I have a problem that I don't see the reason for.
If I send an XML file as an attachment through a program written in xbase, the recipient receives the entire file open in the body of the email message and not as an attachment.
But if I send the same XML file as an attachment through Chrome/Gmail, the recipient correctly receives the file only as an attachment.
This only happens if the sending account is gmail. if I use another email from another service, this does not happen.
Does anyone know why this strange behavior occurs in gmail emails sent by xbase?
Has anyone had this problem?
Many Thanks?
XML file attached in Gmail appears open in message body
XML file attached in Gmail appears open in message body
Pedro Alexandre
Re: XML file attached in Gmail appears open in message body
Try changing the content-type.
oMail:setContentType('multipart/form-data')
oMail:setContentType('multipart/form-data')
The eXpress train is coming - and it has more cars.
Re: XML file attached in Gmail appears open in message body
Roger,
I tried your suggestion but got the same result.
Does this happen with you too?
I tried your suggestion but got the same result.
Does this happen with you too?
Pedro Alexandre
Re: XML file attached in Gmail appears open in message body
Hi Pedro,
I never noticed this problem when sending.
How is the attachment added? As a file?
I'm using Chilkat for sending mails, There is an oEmail:AddFileAttachment( cFile) to use.
With CDO it is something similar as oCdoMessage:AddAttachment(cFile).
I suppose there can be a difference as with images, they can be an atttachment, and they can be part of the mail. Maybe this is the same for your problem and the XML?
I never noticed this problem when sending.
How is the attachment added? As a file?
I'm using Chilkat for sending mails, There is an oEmail:AddFileAttachment( cFile) to use.
With CDO it is something similar as oCdoMessage:AddAttachment(cFile).
I suppose there can be a difference as with images, they can be an atttachment, and they can be part of the mail. Maybe this is the same for your problem and the XML?
Re: XML file attached in Gmail appears open in message body
Hi Chris,
here is sample code :
here is sample code :
Code: Select all
//----------------------------------------------------------------------------------
Procedure SendMail_SMTP()
//----------------------------------------------------------------------------------
LOCAL oSmtp := SMTPClient():new( "smtp.gmail.com",465)
LOCAL oSender := MailAddress():new( "fromemailadress@gmail.com" )
LOCAL oRecipient := MailAddress():new( "toemailadress@gmail.com" )
LOCAL cAttachment := 'C:\File.xml'
LOCAL oMail := MIMEMessage():new()
LOCAL cText := "Anexed, file XML"
//oMail:setContentType('multipart/form-data')
oMail:setContentType('application/xml')
oMail:setFrom ( oSender )
oMail:setSubject ( "XML File attached" )
oMail:setMessage ( cText )
oMail:addRecipient( oRecipient )
oMail:attachFile ( cAttachment )
IF oSmtp:connect( "fromemailadress@gmail.com", "cKeyApp" )
IF oSmtp:send( oMail )
MsgBox( "Message sent" )
ELSE
MsgBox( "Unable to deliver message" )
ENDIF
oSmtp:disconnect()
ELSE
MsgBox( "Unable to connect to mail server" )
ENDIF
RETURN
Pedro Alexandre
Re: XML file attached in Gmail appears open in message body
Hi,
Why are you doing this?
Have you tried it without this setting?
Why are you doing this?
Code: Select all
oMail:setContentType('application/xml')
Re: XML file attached in Gmail appears open in message body
Hi Chris,
Yes, I've tried other settings and it's the same.
Can you try with this code?
The problem only happens when the recipient opens gmail in the browser, eg. in Chrome.
I've already tested it with Chilkat and this problem doesn't happen.
Yes, I've tried other settings and it's the same.
Can you try with this code?
The problem only happens when the recipient opens gmail in the browser, eg. in Chrome.
I've already tested it with Chilkat and this problem doesn't happen.
Pedro Alexandre
Re: XML file attached in Gmail appears open in message body
Hi Pedro,
I'm using Chilkat, and because I don't have to set any contenttype, I was wondering if that could be the cause.
I never had a customer who had this complaint. Electronic invoices are send as XML, so if this would be a problem, customers would have reported this.
Any reason you don't use Chilkat? Since it looks you have it?
I'm using Chilkat, and because I don't have to set any contenttype, I was wondering if that could be the cause.
I never had a customer who had this complaint. Electronic invoices are send as XML, so if this would be a problem, customers would have reported this.
Any reason you don't use Chilkat? Since it looks you have it?
Re: XML file attached in Gmail appears open in message body
Hi Chris,
This strange behavior does not stop the system from working. The XML file is sent as an attachment. It simply appears all open in the body of the email and only at the end of all this text is the link to download.
However, I repeat this situation only if the email received is consulted in gmail online.
If the received email is consulted for example in windows mail everything is OK.
I don't have Chilkat, I've been testing the 30 day version.
I always give preference to developing the needs in native xBase++ or with eXpress++.
But developing in xBase++ is getting difficult and expensive.
Chilkat is an excellent library and it seems to me that sooner or later I will have to buy it, because there are needs that xBase doesn't answer.
However I noticed that sending the email with xBase is much faster than sending it with Chilkat. with Chilkat it is necessary to establish a connection with the Activex component and perhaps this procedure will remove some application performance.
This strange behavior does not stop the system from working. The XML file is sent as an attachment. It simply appears all open in the body of the email and only at the end of all this text is the link to download.
However, I repeat this situation only if the email received is consulted in gmail online.
If the received email is consulted for example in windows mail everything is OK.
I don't have Chilkat, I've been testing the 30 day version.
I always give preference to developing the needs in native xBase++ or with eXpress++.
But developing in xBase++ is getting difficult and expensive.
Chilkat is an excellent library and it seems to me that sooner or later I will have to buy it, because there are needs that xBase doesn't answer.
However I noticed that sending the email with xBase is much faster than sending it with Chilkat. with Chilkat it is necessary to establish a connection with the Activex component and perhaps this procedure will remove some application performance.
Pedro Alexandre