Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- #Адрес сервера
- $SmtpServer="mail.ya.ru";
- #Адрес порта
- $SmtpPort="25";
- #Логин авторизации на сервера SMTP
- $SmtpUser="username";
- #Пароль авторизации на сервера SMTP
- $SmtpPass="password";
- #Класс работы с почтой
- class SMTPClient
- {
- function SMTPClient ($SmtpServer, $SmtpPort, $SmtpUser, $SmtpPass, $from, $to, $subject, $body)
- {
- $this->SmtpServer = $SmtpServer;
- $this->SmtpUser = base64_encode ($SmtpUser);
- $this->SmtpPass = base64_encode ($SmtpPass);
- $this->from = $from;
- $this->to = $to;
- $this->subject = $subject;
- $this->body = $body;
- if ($SmtpPort == "")
- {
- $this->PortSMTP = 25;
- }
- else
- {
- $this->PortSMTP = $SmtpPort;
- }
- }
- function SendMail ()
- {
- if ($SMTPIN = fsockopen ($this->SmtpServer, $this->PortSMTP))
- {
- fputs ($SMTPIN, "EHLO ".$HTTP_HOST."rn");
- $talk["hello"] = fgets ( $SMTPIN, 1024 );
- fputs($SMTPIN, "auth loginrn");
- $talk["res"]=fgets($SMTPIN,1024);
- fputs($SMTPIN, $this->SmtpUser."rn");
- $talk["user"]=fgets($SMTPIN,1024);
- fputs($SMTPIN, $this->SmtpPass."rn");
- $talk["pass"]=fgets($SMTPIN,256);
- fputs ($SMTPIN, "MAIL FROM: <".$this->from.">rn");
- $talk["From"] = fgets ( $SMTPIN, 1024 );
- fputs ($SMTPIN, "RCPT TO: <".$this->to.">rn");
- $talk["To"] = fgets ($SMTPIN, 1024);
- fputs($SMTPIN, "DATArn");
- $talk["data"]=fgets( $SMTPIN,1024 );
- fputs($SMTPIN, "To: <".$this->to.">rnFrom: <".$this->from.">rnSubject:".$this->subject."rnrnrn".$this->body."rn.rn");
- $talk["send"]=fgets($SMTPIN,256);
- fputs ($SMTPIN, "QUITrn");
- fclose($SMTPIN);
- }
- return $talk;
- }
- }
- if (isset($_POST['telephone'])) {$telephone = $_POST['telephone'];}
- if (isset($_POST['fio'])) {$fio = $_POST['fio'];}
- if (isset($_POST['email'])) {$email = $_POST['email'];}
- if (isset($_POST['sale'])) {$sale = $_POST['sale'];}
- if (isset($_POST['sale1'])) {$sale1 = $_POST['sale1'];}
- if (isset($_POST['prop'])) {$prop = $_POST['prop'];}
- if (isset($_POST['col'])) {$col = $_POST['col'];}
- if (isset($_POST['country'])) {$country = $_POST['country'];}
- if (isset($_POST['point'])) {$point = $_POST['point'];}
- if (isset($_POST['transport'])) {$transport = $_POST['transport'];}
- if (isset($_POST['suver'])) {$suver = $_POST['suver'];}
- if (isset($_POST['inshurance'])) {$inshurance = $_POST['inshurance'];}
- /* Сюда впишите свою эл. почту */
- $address = "mail@mail.ru";
- /* А здесь прописывается текст сообщения, n - перенос строки */
- $mes = "Тема: новый запрос!nФИО: $fionТелефон: $telephonenE-mail: $emailnВы хотите: $salenТовар: $sale1nКачественные характеристики: $propnКоличество: $colnСтрана назначения: $countrynПункт назначения: $pointnДополнительные сервисыnТранспорт и логистика $transportnСюрвейерские услуги: $suvernСтрахование поставки: $inshurance";
- /* А эта функция как раз занимается отправкой письма на указанный вами email */
- $sub='Запрос услуг'; //сабж
- $email='robot'; // от кого
- $SMTPMail = new SMTPClient ($SmtpServer, $SmtpPort, $SmtpUser, $SmtpPass, $email, $address, $sub, $mes);
- $SMTPChat = $SMTPMail->SendMail();
- ?>
Add Comment
Please, Sign In to add comment