This is a tricky one to describe. I'm using Ron deBruin's sample code to send an email from Excel VBA, as follows (a cut-down version for the purposes of discussion here, but this is the effective bones of the matter):
The problem is that I'm writing this for a friend whose ISP is btinternet. Mine is O2 (we are in the UK for anyone who doesn't recognise these names). The above code works perfectly on my machine if I replace the smtpserver name above with my O2 one, and remove the smtpauthenticate and smtpusessl parameters even though in the properties of my email account the 'Server requires authentication' box is ticked. The smtpserver name for his system is as given on the BT website, so I'm pretty sure it's correct and valid.
The exact code as given above fails on his machine with the error "The transport failed to connect to the server".
I'm not sure if this is significant, but he has Outlook and I do not. My understanding of the CDO method is that it's independent of the installed mail client.
I have tried all sorts of things, including removing the authentication and usessl parms (separately and together), disabling his anti-virus (one called Avast!), but he gets nothing but the above error or some variation of it (one of which politely asks that authentication should be activated) all of which indicate a lack of communication with the server.
Now I guess I could rewrite it to connect to Outlook using Mr DeBruin's examples but I don't want to do that - it would confuse the user (who isn't particularly computer literate) and the whole point of this exercise is for emails to get sent quickly and silently when he hits the button to do so. Apart from that, I can't develop and test it because I don't have Outlook.
We are both using Office 2007 and Windows 7 Home. He has Outlook 2007. I use Windows Live Mail.
Anyone got any ideas? I'm fresh out. Could the server port be something other than 25? If so, what?
Bookmarks