Email attachments


Recommended Posts

It is most likely an issue with your server. Are you getting an error message? Are you able to send without attachments? Here's the code I used to test (xxx's replacing details that shouldn't be posted):

email.strHost = "xxx.xxxxxx.com"
email.strUserName = "xxxxxxxx"
email.strPassword = "xxxxxxx"
email.strAuthenticate = "AuthLogin"
email.strBody = "test"
email.strTo = "xxxx@azeotech.com"
email.strReplyAddress = "xxxxx@azeotech.com"
email.strFile = "c:\trimtable.csv"
email.Send()

This worked perfectly.

Link to comment
Share on other sites

It is possible that it is a server error but I've set up Outlook Express from the same system with the same settings and had no problems with attachments.

I've sent text emails with no problem, the code is included below.

Email.strHost = "smtp.XXXX.XXXX"

Email.strUserName = ""

Email.strPassword = ""

Email.strTo = "me@me.com"

Email.strSubject = "test email"

Email.strReplyAddress = "XXXX@XXXX"

Email.strReplyName = "XXXX"

Email.strBody = "Test email for email setup"

Email.Mime = 0

Email.strFile = ""

Email.Port = 25

Email.strAuthenticate = "NoLogin"

Email.Send()

When I add a file to send, I get the following error message (made attempts with Mime set to 0, 1):

C1008 Could not send message! Response: 550 Error: invalid message/* or multipart/* encoding domain

I'm currently running DAQFactory Pro 5.15 on a Windows Pro machine.

Thanks.

Link to comment
Share on other sites

That's definitely a server error. Not one of seen before I'm afraid. It appears that the server doesn't like the encoding of the attachment. We've had email support for several years and this is the first I've heard this error. My recommendation if you don't want to chase down the server problem is to skip the attachment altogether and put the file into the body. You said you were doing a .csv file, so its text already. Use the File. functions to load the file and put it into the body. It'd be something like this:

// open the file
private.handle = File.Open("c:\mydata.csv",1,0,0,0)
// get the length
private.length = File.GetLength(handle)
// read the entire file and put into the body of the email
email.strBody = File.Read(handle, length)
// close the file
file.Close(handle)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.