Jump to content

SMTP Server question


CyRius
 Share

Recommended Posts

Im creating an smtp (and a pop3) server, but i am stucked.

SMTP servers usually listening on the port 25, right? But there are exceptions like gmail (465).

Lets say my server receives an email from the client with a recipient <somebody@gmail.com>. How could the server decide which port to use to connect to the recipient's smtp server? And how to decide which IP to connect (gmail.com is different than smtp.gmail.com). And how to decide to use SSL/TLS authentication or not?

Greetz, CyRius

Edited by CyRius

[font="Courier New"][size="3"]CyRius Developments[/size][/font][list][*]CO Proxy[*]CO Assembly tool[*]CO PacketSniffer[*]Larkinor proxy[*]BoIM Messenger[*]Encrypt/Decrypt[*]Hashtables[*]Slowest, but greatest skins ever xD[/list]

Link to comment
Share on other sites

  • Developers

You are sure you want to create a server or are you intending to write a client, else I am lost why you would ask about regular and secure connections used by GMail and having to be able to check for that?

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

@Jos

Im writing an smtp server, not a client. Maybe I am wrong, but as I know, if I use Outlook and I want to send an email to myfriend@gmail.com then the mail must go trough Outlook -> MySMTP Server -> Gmail's SMTP server -> Gmail's POP3 server.

The problem starts there when MySMTP server must connect to Gmail's SMTP server, because I don't know how could I find out the ip of smtp.gmail.com and the port 465 (because the address is only myfriend@gmail.com not myfriend@smtp.gmail.com:465)

Edited by CyRius

[font="Courier New"][size="3"]CyRius Developments[/size][/font][list][*]CO Proxy[*]CO Assembly tool[*]CO PacketSniffer[*]Larkinor proxy[*]BoIM Messenger[*]Encrypt/Decrypt[*]Hashtables[*]Slowest, but greatest skins ever xD[/list]

Link to comment
Share on other sites

  • Developers

So tell me: what would the purpose of your server be?

Why do you need it to sit between your own client and the real MailServer?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Im creating a project: Messenger - server, Webserver, SMTP and pop3 server.

These servers will use a single database. After registering a messenger account you will receive an inbox too for your emails (like Yahoo! and MSN).

It is not possible to create inboxes for the users if I dont have my own smtp and pop server. I can receive emails from yahoo but im stucked with sending them to other mail providers. (sorry for my bad english ^^)

Edited by CyRius

[font="Courier New"][size="3"]CyRius Developments[/size][/font][list][*]CO Proxy[*]CO Assembly tool[*]CO PacketSniffer[*]Larkinor proxy[*]BoIM Messenger[*]Encrypt/Decrypt[*]Hashtables[*]Slowest, but greatest skins ever xD[/list]

Link to comment
Share on other sites

  • Developers

Im creating a project: Messenger - server, Webserver, SMTP and pop3 server.

These servers will use a single database. After registering a messenger account you will receive an inbox too for your emails (like Yahoo! and MSN).

It is not possible to create inboxes for the users if I dont have my own smtp and pop server. I can receive emails from yahoo but im stucked with sending them to other mail providers. (sorry for my bad english ^^)

You are not really describing a Mailserver but you want the UserClient to connect to your Server which then will do the Client session with the real MailServer.

To me a real MailServer gets his own domain and will have mailboxes for multiple users in that domain. In the background it will have and Mailtransport engine that transfers the Email from your domain to other domains. Standard SMTP/POP isn't a difficult protocol, but added SSL to that would mean you need to have all userId's and Passwords for the individual accounts available in the server and need to write support for that. Not sure what is needed for that but doubt that this is simple to do unless you can build on an existing COMM object like I did in the _InetSmtpMailCom() function which uses CDO.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

I saw the _InetSmtpMailCom() function but I already wrote a function without objects. I just want to know the port and the IP. This is the main problem. I can send/receive emails to/from my servers (using Outlook). Do you have any idea how could I find out the IP or/and the port? As I see, you know much more about these things:) (SSL and TLS can wait until I find the IPs and the ports:)

One more question:

If I send a mail from yahoo website to gmail then the mail's way is:

Yahoo Site -> YahooSMTP -> GMailSMTP -> GMailPOP

OR

Yahoo Site -> YahooSMTP -> GMailPOP?

Edited by CyRius

[font="Courier New"][size="3"]CyRius Developments[/size][/font][list][*]CO Proxy[*]CO Assembly tool[*]CO PacketSniffer[*]Larkinor proxy[*]BoIM Messenger[*]Encrypt/Decrypt[*]Hashtables[*]Slowest, but greatest skins ever xD[/list]

Link to comment
Share on other sites

  • Developers

I saw the _InetSmtpMailCom() function but I already wrote a function without objects. I just want to know the port and the IP. This is the main problem. I can send/receive emails to/from my servers (using Outlook). Do you have any idea how could I find out the IP or/and the port? As I see, you know much more about these things:) (SSL and TLS can wait until I find the IPs and the ports:)

The IP for Gmail is a matter of doing a dns lookup for smtp.gmail.com and the port is fixed on 465. (both are listed in my UDF :mellow: )

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Yes, I know but, if i want to send to any other provider not GMail which uses different ip and port then how i will know?

[font="Courier New"][size="3"]CyRius Developments[/size][/font][list][*]CO Proxy[*]CO Assembly tool[*]CO PacketSniffer[*]Larkinor proxy[*]BoIM Messenger[*]Encrypt/Decrypt[*]Hashtables[*]Slowest, but greatest skins ever xD[/list]

Link to comment
Share on other sites

  • Developers

One more question:

If I send a mail from yahoo website to gmail then the mail's way is:

Yahoo Site -> YahooSMTP -> GMailSMTP -> GMailPOP

OR

Yahoo Site -> YahooSMTP -> GMailPOP?

The Webclient will create the Email in the outqueue (OutBox) on the Yahoo server. A background process will connect to the GMail server by doing the following:

1. Do a DNS request for the MX record of the Domain you send the Email to (gmail.com) which will return the target information.

2. connect via the (E)SMTP protocol to the found SMTP server IP address and deliver the mail.

Port in general is port 25 and am not 100% sure how that is done with GMAIL in the case of inter-server traffic.

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

(...)1. Do a DNS request for the MX record of the Domain

Hmm, I have searched for MX record on the wikipedia, but there doesnt write how can I get that DNS list. Are there any functions or dll's?

[font="Courier New"][size="3"]CyRius Developments[/size][/font][list][*]CO Proxy[*]CO Assembly tool[*]CO PacketSniffer[*]Larkinor proxy[*]BoIM Messenger[*]Encrypt/Decrypt[*]Hashtables[*]Slowest, but greatest skins ever xD[/list]

Link to comment
Share on other sites

  • Developers

This could be an "simple" option to use nslookup and capture the output:

nslookup -type=mx gmail.com

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Oh, thank you very much! You helped me a lot:)

Greetz, CyRius

[font="Courier New"][size="3"]CyRius Developments[/size][/font][list][*]CO Proxy[*]CO Assembly tool[*]CO PacketSniffer[*]Larkinor proxy[*]BoIM Messenger[*]Encrypt/Decrypt[*]Hashtables[*]Slowest, but greatest skins ever xD[/list]

Link to comment
Share on other sites

  • 1 month later...

I have this below and Im trying to send a simple mail. However I get an ERROR CODE 2 "Transport Failed to Connect to Server?" Please help. I'm not that skilled in doing this.

;

;##################################

; Include

;##################################

#Include<file.au3>

#include <INet.au3>

;################################## ; Variables

;##################################

;$SmtpServer = "alt3.gmail-smtp-in.l.google.com" ; address for the smtp-server to use - REQUIRED

$SmtpServer = "smtp.gmail.com" ; address for the smtp-server to use - REQUIRED

$FromName = "Gaiaplay" ; name from who the email was sent

$FromAddress = "gaiaplay72@gmail.com" ; address from where the mail should come

$ToAddress = "ddo_gears@yahoo.com" ; destination address of the email - REQUIRED

$Subject = "Hello World!" ; subject from the email - can be anything you want it to be

$Body = "This script is great! See attachment!" ; the messagebody from the mail - can be left blank but then you get a blank mail

$AttachFiles = "C:\File.txt" ; the file you want to attach- leave blank if not needed

$CcAddress = "" ; address for cc - leave blank if not needed

$BccAddress = "" ; address for bcc - leave blank if not needed

$Importance = "Normal" ; Send message priority: "High", "Normal", "Low"

$Username = "gaiaplay72@gmail.com" ; username for the account used from where the mail gets sent - REQUIRED

$Password = "*******" ; password for the account used from where the mail gets sent - REQUIRED

$IPPort = 465 ; port used for sending the mail

$ssl = 1

Edited by gaiaplay
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...