Jump to content

Recommended Posts

Posted

The following code fails to send a message unless I change the

'With $objMessage

.From = $fromname

item to (null) for example

.From = ""

how do I make it work with a from name Help is always apreciated

Ant..

CODE
$oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")

$objMessage = ObjCreate("CDO.Message")

With $objMessage

.Subject = $data2

.Sender = $fromaddr

.From = $fromname

.To = $data1

.TextBody = $data3 & @CRLF & $data4 & @CRLF & $data5 & @CRLF & $data6

If $fileattach <> "" Then

.AddAttachment ($fileattach)

EndIf

EndWith

With $objMessage.Configuration.Fields

.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $isp ; <== SMTP SERVER

.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1

.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = $ispuser ; <== SMTP USERNAME

.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $isppw ; <== SMTP PASSWORD

.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $ispport

.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60

If $ispssl = 0 Then

.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False

Else

.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True

EndIf

.Update

EndWith

$objMessage.Send

Posted

I have been able to resolve this issue as follows:

My mail server requires the '.From' to be exactly the same as ' .Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") ' otherwise the email will not be sent and where it is not the same you get a Code 553 Authentication Required.

Don't ask me why cause I have no idea but I thought that the solution would be of interest to subscribers.

Cheers

Ant..

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...