MCPcopy Create free account
hub / github.com/MaxBelkov/visualsyslog / SendInternal

Method SendInternal

sourcecommon/sendmail.cpp:132–221  ·  view source on GitHub ↗

---------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

130}
131//---------------------------------------------------------------------------
132bool TSendmailThread::SendInternal(TLetter * p)
133{
134 bool rv = false;
135 TIdMessage * m = NULL;
136 try
137 {
138 m = new TIdMessage(NULL);
139
140 m->OnInitializeISO = iiso;
141 //m->ContentTransferEncoding = "base64";
142 m->ContentType = "text/plain";
143 m->CharSet = "utf-8";
144
145 // ��� Sender ������� � ����
146 m->Sender->Name = ToUft8Header(p->sender_name);
147 m->Sender->Address = p->sender;
148
149 m->From->Name = p->sender_name;
150 m->From->Address = p->sender;
151
152 m->Recipients->EMailAddresses = p->recipient;
153
154 m->Subject = p->subject;
155 m->Body->Text = p->message;
156
157 smtp->Host = p->server;
158 smtp->Port = p->port;
159 smtp->Username = p->username;
160 smtp->Password = p->password;
161
162 switch( p->ssl )
163 {
164 case 0: // ��� (������������ �����������)
165 smtp->UseTLS = utNoTLSSupport;
166 break;
167 case 1: // ������������ SSL ����� (������ 465 ����)
168 smtp->UseTLS = utUseImplicitTLS;
169 break;
170 case 2: // ������������ TLS ����� ���� ��� ������ �������� (������ 587 ����)
171 smtp->UseTLS = utUseRequireTLS;
172 break;
173 }
174
175 if( smtp->Host.IsEmpty() )
176 throw EIdException("smtp server address not defined");
177
178 smtp->Connect();
179
180 smtp->Send(m);
181
182 p->error = "";
183 rv = true;
184 }
185 catch(EIdSMTPReplyError &e)
186 {
187 p->error.printf("%s (%s [%d])", e.Message.c_str(),
188 smtpError(e.ErrorCode).c_str(), e.ErrorCode);
189 }

Callers

nothing calls this directly

Calls 3

ToUft8HeaderFunction · 0.85
smtpErrorFunction · 0.85
SendMethod · 0.80

Tested by

no test coverage detected